Kevin Grittner wrote:
Interesting stuff.
> /*
> + * SetRelationIsValid
> + * Set the value of the relation's relisvalid field in pg_class.
> + *
> + * NOTE: caller must be holding an appropriate lock on the relation.
> + * ShareUpdateExclusiveLock is sufficient.
> + *
> + * NOTE: an important side-effect of this operation is that an SI invalidation
> + * message is sent out to all backends --- including me --- causing plans
> + * referencing the relation to be rebuilt with the new list of children.
> + * This must happen even if we find that no change is needed in the pg_class
> + * row.
> + */
> + void
> + SetRelationIsValid(Oid relationId, bool relisvalid)
> + {
It's not clear to me that it's right to do this by doing regular heap
updates here instead of heap_inplace_update. Also, I think this might
end up causing a lot of pg_class tuple churn (at least for matviews that
delete rows at xact end), which would be nice to avoid.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services