• Tom Lane's avatar
    Fix permission tests for views/tables proven empty by constraint exclusion. · 50c13748
    Tom Lane authored
    A view defined as "select <something> where false" had the curious property
    that the system wouldn't check whether users had the privileges necessary
    to select from it.  More generally, permissions checks could be skipped
    for tables referenced in sub-selects or views that were proven empty by
    constraint exclusion (although some quick testing suggests this seldom
    happens in cases of practical interest).  This happened because the planner
    failed to include rangetable entries for such tables in the finished plan.
    
    This was noticed in connection with erroneous handling of materialized
    views, but actually the issue is quite unrelated to matviews.  Therefore,
    revert commit 200ba166 in favor of a more
    direct test for the real problem.
    
    Back-patch to 9.2 where the bug was introduced (by commit
    7741dd65).
    50c13748
privileges.sql 27.7 KB