• Tom Lane's avatar
    Create an RTE field to record the query's lock mode for each relation. · fdba460a
    Tom Lane authored
    Add RangeTblEntry.rellockmode, which records the appropriate lock mode for
    each RTE_RELATION rangetable entry (either AccessShareLock, RowShareLock,
    or RowExclusiveLock depending on the RTE's role in the query).
    
    This patch creates the field and makes all creators of RTE nodes fill it
    in reasonably, but for the moment nothing much is done with it.  The plan
    is to replace assorted post-parser logic that re-determines the right
    lockmode to use with simple uses of rte->rellockmode.  For now, just add
    Asserts in each of those places that the rellockmode matches what they are
    computing today.  (In some cases the match isn't perfect, so the Asserts
    are weaker than you might expect; but this seems OK, as per discussion.)
    
    This passes check-world for me, but it seems worth pushing in this state
    to see if the buildfarm finds any problems in cases I failed to test.
    
    catversion bump due to change of stored rules.
    
    Amit Langote, reviewed by David Rowley and Jesper Pedersen,
    and whacked around a bit more by me
    
    Discussion: https://postgr.es/m/468c85d9-540e-66a2-1dde-fec2b741e688@lab.ntt.co.jp
    fdba460a
planner.c 228 KB