Skip to content
Snippets Groups Projects
Select Git revision
  • benchmark-tools
  • postgres-lambda
  • master default
  • REL9_4_25
  • REL9_5_20
  • REL9_6_16
  • REL_10_11
  • REL_11_6
  • REL_12_1
  • REL_12_0
  • REL_12_RC1
  • REL_12_BETA4
  • REL9_4_24
  • REL9_5_19
  • REL9_6_15
  • REL_10_10
  • REL_11_5
  • REL_12_BETA3
  • REL9_4_23
  • REL9_5_18
  • REL9_6_14
  • REL_10_9
  • REL_11_4
23 results

tablecmds.c

  • Stephen Frost's avatar
    6550b901
    Code review for row security. · 6550b901
    Stephen Frost authored
    Buildfarm member tick identified an issue where the policies in the
    relcache for a relation were were being replaced underneath a running
    query, leading to segfaults while processing the policies to be added
    to a query.  Similar to how TupleDesc RuleLocks are handled, add in a
    equalRSDesc() function to check if the policies have actually changed
    and, if not, swap back the rsdesc field (using the original instead of
    the temporairly built one; the whole structure is swapped and then
    specific fields swapped back).  This now passes a CLOBBER_CACHE_ALWAYS
    for me and should resolve the buildfarm error.
    
    In addition to addressing this, add a new chapter in Data Definition
    under Privileges which explains row security and provides examples of
    its usage, change \d to always list policies (even if row security is
    disabled- but note that it is disabled, or enabled with no policies),
    rework check_role_for_policy (it really didn't need the entire policy,
    but it did need to be using has_privs_of_role()), and change the field
    in pg_class to relrowsecurity from relhasrowsecurity, based on
    Heikki's suggestion.  Also from Heikki, only issue SET ROW_SECURITY in
    pg_restore when talking to a 9.5+ server, list Bypass RLS in \du, and
    document --enable-row-security options for pg_dump and pg_restore.
    
    Lastly, fix a number of minor whitespace and typo issues from Heikki,
    Dimitri, add a missing #include, per Peter E, fix a few minor
    variable-assigned-but-not-used and resource leak issues from Coverity
    and add tab completion for role attribute bypassrls as well.
    6550b901
    History
    Code review for row security.
    Stephen Frost authored
    Buildfarm member tick identified an issue where the policies in the
    relcache for a relation were were being replaced underneath a running
    query, leading to segfaults while processing the policies to be added
    to a query.  Similar to how TupleDesc RuleLocks are handled, add in a
    equalRSDesc() function to check if the policies have actually changed
    and, if not, swap back the rsdesc field (using the original instead of
    the temporairly built one; the whole structure is swapped and then
    specific fields swapped back).  This now passes a CLOBBER_CACHE_ALWAYS
    for me and should resolve the buildfarm error.
    
    In addition to addressing this, add a new chapter in Data Definition
    under Privileges which explains row security and provides examples of
    its usage, change \d to always list policies (even if row security is
    disabled- but note that it is disabled, or enabled with no policies),
    rework check_role_for_policy (it really didn't need the entire policy,
    but it did need to be using has_privs_of_role()), and change the field
    in pg_class to relrowsecurity from relhasrowsecurity, based on
    Heikki's suggestion.  Also from Heikki, only issue SET ROW_SECURITY in
    pg_restore when talking to a 9.5+ server, list Bypass RLS in \du, and
    document --enable-row-security options for pg_dump and pg_restore.
    
    Lastly, fix a number of minor whitespace and typo issues from Heikki,
    Dimitri, add a missing #include, per Peter E, fix a few minor
    variable-assigned-but-not-used and resource leak issues from Coverity
    and add tab completion for role attribute bypassrls as well.