• Tom Lane's avatar
    Simplify view-expansion code in rewriteHandler.c. · 49ac4039
    Tom Lane authored
    In the wake of commit 50c6bb02, it's not necessary for ApplyRetrieveRule
    to have a forUpdatePushedDown parameter.  By the time control gets here for
    any given view-referencing RTE, we should already have pushed down the
    effects of any FOR UPDATE/SHARE clauses affecting the view from outer query
    levels.  Hence if we don't find a RowMarkClause at the current query level,
    that's sufficient proof that there is no outer one either.  This in turn
    means we need no forUpdatePushedDown parameter for fireRIRrules.
    
    I wonder whether we oughtn't also revert commit cba2d271, since it now
    seems likely that that was band-aiding around the bad effects of doing
    FOR UPDATE pushdown and view expansion in the wrong order.  However,
    in the absence of evidence that the current coding of markQueryForLocking
    is actually buggy (i.e. missing RTEs it ought to mark), it seems best to
    leave it alone.
    
    Discussion: https://postgr.es/m/24db7b8f-3de5-e25f-7ab9-d8848351d42c@gmail.com
    49ac4039
rewriteHandler.c 113 KB