1. 12 Jun, 2019 1 commit
    • Michael Paquier's avatar
      Fix handling of COMMENT for domain constraints · ceac4505
      Michael Paquier authored
      For a non-superuser, changing a comment on a domain constraint was
      leading to a cache lookup failure as the code tried to perform the
      ownership lookup on the constraint OID itself, thinking that it was a
      type, but this check needs to happen on the type the domain constraint
      relies on.  As the type a domain constraint relies on can be guessed
      directly based on the constraint OID, first fetch its type OID and
      perform the ownership on it.
      
      This is broken since 7eca575d, which has split the handling of comments
      for table constraints and domain constraints, so back-patch down to
      9.5.
      
      Reported-by: Clemens Ladisch
      Author: Daniel Gustafsson, Michael Paquier
      Reviewed-by: Álvaro Herrera
      Discussion: https://postgr.es/m/15833-808e11904835d26f@postgresql.org
      Backpatch-through: 9.5
      ceac4505
  2. 11 Jun, 2019 7 commits
  3. 10 Jun, 2019 4 commits
  4. 09 Jun, 2019 4 commits
  5. 08 Jun, 2019 5 commits
  6. 07 Jun, 2019 3 commits
  7. 06 Jun, 2019 6 commits
  8. 05 Jun, 2019 4 commits
  9. 04 Jun, 2019 4 commits
  10. 03 Jun, 2019 2 commits
    • Tom Lane's avatar
      Fix contrib/auto_explain to not cause problems in parallel workers. · 2cd4e835
      Tom Lane authored
      A parallel worker process should not be making any decisions of its
      own about whether to auto-explain.  If the parent session process
      passed down flags asking for instrumentation data, do that, otherwise
      not.  Trying to enable instrumentation anyway leads to bugs like the
      "could not find key N in shm TOC" failure reported in bug #15821
      from Christian Hofstaedtler.
      
      We can implement this cheaply by piggybacking on the existing logic
      for not doing anything when we've chosen not to sample a statement.
      
      While at it, clean up some tin-eared coding related to the sampling
      feature, including an off-by-one error that meant that asking for 1.0
      sampling rate didn't actually result in sampling every statement.
      
      Although the specific case reported here only manifested in >= v11,
      I believe that related misbehaviors can be demonstrated in any version
      that has parallel query; and the off-by-one error is certainly there
      back to 9.6 where that feature was added.  So back-patch to 9.6.
      
      Discussion: https://postgr.es/m/15821-5eb422e980594075@postgresql.org
      2cd4e835
    • Tom Lane's avatar
      Fix unsafe memory management in CloneRowTriggersToPartition(). · eaf0292c
      Tom Lane authored
      It's not really supported to call systable_getnext() in a different
      memory context than systable_beginscan() was called in, and it's
      *definitely* not safe to do so and then reset that context between
      calls.  I'm not very clear on how this code survived
      CLOBBER_CACHE_ALWAYS testing ... but Alexander Lakhin found a case
      that would crash it pretty reliably.
      
      Per bug #15828.  Fix, and backpatch to v11 where this code came in.
      
      Discussion: https://postgr.es/m/15828-f6ddd7df4852f473@postgresql.org
      eaf0292c