Tom Lane wrote:
> Bruce Momjian <[EMAIL PROTECTED]> writes:
> > while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0)))
> > + {
> > heap_delete(lRel, &lTuple->t_self, NULL);
> > + if (RelationGetForm(lRel)->relhasindex)
> > + {
> > + Relation idescs[Num_pg_listener_indices];
>
> > + CatalogOpenIndices(Num_pg_listener_indices,
>Name_pg_listener_indices, idescs);
> > + CatalogIndexInsert(idescs, Num_pg_listener_indices, lRel, rTuple);
> > + CatalogCloseIndices(Num_pg_listener_indices, idescs);
> > + }
> > + }
>
> What?? heap_delete doesn't require index updates AFAIK. Have you
> tested this?
First it's absolutely (ahem sorry) braindead to insert new
index entries for an existing, now marked deleted heap tuple.
Second, no modifications to an index are ever rolled back. In
fact, the indices in Postgres might contain any number of
duplicate keys pointing to different instances of one and the
same tuple. It's the visibility of the corresponding heap
tuples that controls which of them an index scan returns.
It is VACUUMs job to remove index tuples pointing to some
TID, VACUUM decided that it's no longer needed.
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== [EMAIL PROTECTED] #