Hi,
In an postgres build that has added instrumentation to detect cases
where indexes are index_open()ed without any locks on the underlying
relation, the matview code started to cry during the regression tests.
The problem seems to be that refresh_matview_datafill() uses
QueryRewrite() without previously using AcquireRewriteLocks() but as
QueryRewrite states:
* ...
* NOTE: the parsetree must either have come straight from the parser,
* or have been scanned by AcquireRewriteLocks to acquire suitable locks.
*/
I think the missed locks could lead to postgres crashing under
concurrent DDL.
I've attached a quick patch that fixes the issue for me in HEAD, but I
am not 100% sure I understand the details of refresh_matview_datafill().
This probably needs to go into 9.3 in an adapted form.
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services