Re: WIP: Covering + unique indexes.
Peter Geoghegan <pg@heroku.com>
On Wed, Apr 6, 2016 at 6:15 AM, Anastasia Lubennikova <a.lubennikova@postgrespro.ru> wrote: >> * I would like to see index_reform_tuple() assert that the new, >> truncated index tuple is definitely <= the original (I worry about the >> 1/3 page restriction issue). Maybe you should also change the name of >> index_reform_tuple(), per David. > > Is it possible that the new tuple, containing less attributes than the old > one, will have a greater size? > Maybe you can give an example? > I think that Assert(indnkeyatts <= indnatts); covers this kind of errors. I don't think it is possible, because you aren't e.g. making an attribute's value NULL where it wasn't NULL before (making the IndexTuple contain a NULL bitmap where it didn't before). But that's kind of subtle, and it certainly seems worth an assertion. It could change tomorrow, when someone optimizes heap_deform_tuple(), which has been proposed more than once. Personally, I like documenting assertions, and will sometimes write assertions that the compiler could easily optimize away. Maybe going *that* far is more a matter of personal style, but I think an assertion about the new index tuple size being <= the old one is just a good idea. It's not about a problem in your code at all. > I do not mind to rename this function, but what name would be better? > index_truncate_tuple()? That seems better, yes. -- Peter Geoghegan
Commits
-
Adjust INCLUDE index truncation comments and code.
- 075aade4361b 11.0 landed
-
Add commentary explaining why MaxIndexTuplesPerPage calculation is safe.
- 2a67d6440db4 11.0 cited
-
Indexes with INCLUDE columns and their support in B-tree
- 8224de4f42cc 11.0 landed
-
Add amcheck verification of heap relations belonging to btree indexes.
- 7f563c09f890 11.0 cited
-
Doc: move info for btree opclass implementors into main documentation.
- 3785f7eee3d9 11.0 cited
-
Doc: mention that you can't PREPARE TRANSACTION after NOTIFY.
- e4fbf22831c2 11.0 cited
-
Remove dedicated B-tree root-split record types.
- 0c504a80cf2e 11.0 cited
-
Restructure index access method API to hide most of it at the C level.
- 65c5fcd353a8 9.6.0 cited
-
Split _bt_insertonpg to two functions.
- bc292937ae6a 8.3.0 cited
-
Major overhaul of btree index code. Eliminate special BTP_CHAIN logic for
- 9e85183bfc31 7.1.1 cited