1. 19 Apr, 2019 1 commit
    • Andres Freund's avatar
      Fix potential use-after-free for BEFORE UPDATE row triggers on non-core AMs. · 75e03eab
      Andres Freund authored
      When such a trigger returns the old row version, it naturally get
      stored in the slot for the trigger result. When a table AMs doesn't
      store HeapTuples internally, ExecBRUpdateTriggers() frees the old row
      version passed to triggers - but before this fix it might still be
      referenced by the slot holding the new tuple.
      
      Noticed when running the out-of-core zheap AM against the in-core
      version of tableam.
      
      Author: Andres Freund
      75e03eab
  2. 18 Apr, 2019 4 commits
  3. 17 Apr, 2019 11 commits
  4. 16 Apr, 2019 4 commits
  5. 15 Apr, 2019 10 commits
  6. 14 Apr, 2019 2 commits
  7. 13 Apr, 2019 4 commits
    • Noah Misch's avatar
      When Perl "kill(9, ...)" fails, try "pg_ctl kill". · 947a3501
      Noah Misch authored
      Per buildfarm member jacana, the former fails under msys Perl 5.8.8.
      Back-patch to 9.6, like the code in question.
      
      Discussion: https://postgr.es/m/GrdLgAdUK9FdyZg8VIcTDKVOkys122ZINEb3CjjoySfGj2KyPiMKTh1zqtRp0TAD7FJ27G-OBB3eplxIB5GhcQH5o8zzGZfp0MuJaXJxVxk=@yesql.se
      947a3501
    • Tom Lane's avatar
      Prevent memory leaks associated with relcache rd_partcheck structures. · 5f1433ac
      Tom Lane authored
      The original coding of generate_partition_qual() just copied the list
      of predicate expressions into the global CacheMemoryContext, making it
      effectively impossible to clean up when the owning relcache entry is
      destroyed --- the relevant code in RelationDestroyRelation() only managed
      to free the topmost List header :-(.  This resulted in a session-lifespan
      memory leak whenever a table partition's relcache entry is rebuilt.
      Fortunately, that's not normally a large data structure, and rebuilds
      shouldn't occur all that often in production situations; but this is
      still a bug worth fixing back to v10 where the code was introduced.
      
      To fix, put the cached expression tree into its own small memory context,
      as we do with other complicated substructures of relcache entries.
      Also, deal more honestly with the case that a partition has an empty
      partcheck list; while that probably isn't a case that's very interesting
      for production use, it's legal.
      
      In passing, clarify comments about how partitioning-related relcache
      data structures are managed, and add some Asserts that we're not leaking
      old copies when we overwrite these data fields.
      
      Amit Langote and Tom Lane
      
      Discussion: https://postgr.es/m/7961.1552498252@sss.pgh.pa.us
      5f1433ac
    • Noah Misch's avatar
      Consistently test for in-use shared memory. · c0985099
      Noah Misch authored
      postmaster startup scrutinizes any shared memory segment recorded in
      postmaster.pid, exiting if that segment matches the current data
      directory and has an attached process.  When the postmaster.pid file was
      missing, a starting postmaster used weaker checks.  Change to use the
      same checks in both scenarios.  This increases the chance of a startup
      failure, in lieu of data corruption, if the DBA does "kill -9 `head -n1
      postmaster.pid` && rm postmaster.pid && pg_ctl -w start".  A postmaster
      will no longer stop if shmat() of an old segment fails with EACCES.  A
      postmaster will no longer recycle segments pertaining to other data
      directories.  That's good for production, but it's bad for integration
      tests that crash a postmaster and immediately delete its data directory.
      Such a test now leaks a segment indefinitely.  No "make check-world"
      test does that.  win32_shmem.c already avoided all these problems.  In
      9.6 and later, enhance PostgresNode to facilitate testing.  Back-patch
      to 9.4 (all supported versions).
      
      Reviewed (in earlier versions) by Daniel Gustafsson and Kyotaro HORIGUCHI.
      
      Discussion: https://postgr.es/m/20190408064141.GA2016666@rfd.leadboat.com
      c0985099
    • Michael Paquier's avatar
      Revert "Switch TAP tests of pg_rewind to use a role with minimal permissions" · db8db624
      Michael Paquier authored
      This reverts commit d4e2a843, which added a new user with limited
      permissions to run the TAP tests of pg_rewind.  Buildfarm machine
      members on Windows jacana and bowerbird have been complaining about
      that, the new role not being able to run the rewind because SSPI is not
      configured to allow it.
      
      Fixing the test requires passing down directly the new user to
      pg_regress with --create-role so as SSPI can work properly.
      
      Reported-by: Andrew Dunstan
      Discussion: https://postgr.es/m/3cd43d33-f415-cc41-ade3-7230ab15b2c9@2ndQuadrant.com
      db8db624
  8. 12 Apr, 2019 4 commits