1. 22 Jul, 2021 2 commits
  2. 21 Jul, 2021 4 commits
  3. 20 Jul, 2021 5 commits
    • Bruce Momjian's avatar
      doc: PG 14 relnote adjustments · f8d1333d
      Bruce Momjian authored
      Reported-by: Elena Indrupskaya
      
      Discussion: https://postgr.es/m/38555778-a56b-4aca-2581-e05582fc9bcf@postgrespro.ru
      
      Author: Elena Indrupskaya
      
      Backpatch-through: 14 only
      f8d1333d
    • Tom Lane's avatar
      Fix corner-case uninitialized-variable issues in plpgsql. · 899564e0
      Tom Lane authored
      If an error was raised during our initial attempt to check whether
      a successfully-compiled expression is "simple", subsequent calls of
      exec_stmt_execsql would suppose that stmt->mod_stmt was already computed
      when it had not been.  This could lead to assertion failures in debug
      builds; in production builds the effect would typically be to act as
      if INTO STRICT had been specified even when it had not been.  Of course
      that only matters if the subsequent attempt to execute the expression
      succeeds, so that the problem can only be reached by fixing a failure
      in some referenced, inline-able SQL function and then retrying the
      calling plpgsql function in the same session.
      
      (There might be even-more-obscure ways to change the expression's
      behavior without changing the plpgsql function, but that one seems
      like the only one people would be likely to hit in practice.)
      
      The most foolproof way to fix this would be to arrange for
      exec_prepare_plan to not set expr->plan until we've finished the
      subsidiary simple-expression check.  But it seems hard to do that
      without creating reference-count leak issues.  So settle for documenting
      the hazard in a comment and fixing exec_stmt_execsql to test separately
      for whether it's computed stmt->mod_stmt.  (That adds a test-and-branch
      per execution, but hopefully that's negligible in context.)  In v11 and
      up, also fix exec_stmt_call which had a variant of the same issue.
      
      Per bug #17113 from Alexander Lakhin.  Back-patch to all
      supported branches.
      
      Discussion: https://postgr.es/m/17113-077605ce00e0e7ec@postgresql.org
      899564e0
    • Michael Paquier's avatar
      Fix some issues with WAL segment opening for pg_receivewal --compress · 3a0d2d0c
      Michael Paquier authored
      The logic handling the opening of new WAL segments was fuzzy when using
      --compress if a partial, non-compressed, segment with the same base name
      existed in the repository storing those files.  In this case, using
      --compress would cause the code to first check for the existence and the
      size of a non-compressed segment, followed by the opening of a new
      compressed, partial, segment.  The code was accidentally working
      correctly on most platforms as the buildfarm has proved, except
      bowerbird where gzflush() could fail in this code path.  It is wrong
      anyway to take the code path used pre-padding when creating a new
      partial, non-compressed, segment, so let's fix it.
      
      Note that this issue exists when users mix successive runs of
      pg_receivewal with or without compression, as discovered with the tests
      introduced by ffc9dda.
      
      While on it, this refactors the code so as code paths that need to know
      about the ".gz" suffix are down from four to one in walmethods.c, easing
      a bit the introduction of new compression methods.  This addresses a
      second issue where log messages generated for an unexpected failure
      would not show the compressed segment name involved, which was
      confusing, printing instead the name of the non-compressed equivalent.
      
      Reported-by: Georgios Kokolatos
      Discussion: https://postgr.es/m/YPDLz2x3o1aX2wRh@paquier.xyz
      Backpatch-through: 10
      3a0d2d0c
    • Peter Geoghegan's avatar
      Doc: vacuum_multixact_failsafe_age is multixact-based. · e1cdf617
      Peter Geoghegan authored
      Oversight in commit 1e55e7d1, which added a wraparound failsafe
      mechanism to VACUUM.
      
      Backpatch: 14-, where VACUUM failsafe was introduced.
      e1cdf617
    • Peter Geoghegan's avatar
      vacuumdb: Correct comment about --force-index-cleanup. · 9a3d41a2
      Peter Geoghegan authored
      Commit 3499df0d added a comment that incorrectly suggested that
      --force-index-cleanup did not appear in the same major version as the
      similar --no-index-cleanup option.  In fact, both options are new to
      PostgreSQL 14.
      
      Backpatch: 14-, where both options were introduced.
      9a3d41a2
  4. 19 Jul, 2021 3 commits
  5. 18 Jul, 2021 1 commit
    • Alexander Korotkov's avatar
      Support for unnest(multirange) · 244ad541
      Alexander Korotkov authored
      It has been spotted that multiranges lack of ability to decompose them into
      individual ranges.  Subscription and proper expanded object representation
      require substantial work, and it's too late for v14.  This commit
      provides the implementation of unnest(multirange), which is quite trivial.
      unnest(multirange) is defined as a polymorphic procedure.
      
      Catversion is bumped.
      
      Reported-by: Jonathan S. Katz
      Discussion: https://postgr.es/m/flat/60258efe-bd7e-4886-82e1-196e0cac5433%40postgresql.org
      Author: Alexander Korotkov
      Reviewed-by: Justin Pryzby, Jonathan S. Katz, Zhihong Yu, Tom Lane
      Reviewed-by: Alvaro Herrera
      244ad541
  6. 17 Jul, 2021 2 commits
  7. 16 Jul, 2021 4 commits
  8. 15 Jul, 2021 4 commits
  9. 14 Jul, 2021 4 commits
  10. 13 Jul, 2021 3 commits
    • Tom Lane's avatar
      Rename debug_invalidate_system_caches_always to debug_discard_caches. · 6201fa3c
      Tom Lane authored
      The name introduced by commit 4656e3d6 was agreed to be unreasonably
      long.  To match this change, rename initdb's recently-added
      --clobber-cache option to --discard-caches.
      
      Discussion: https://postgr.es/m/1374320.1625430433@sss.pgh.pa.us
      6201fa3c
    • David Rowley's avatar
      Robustify tuplesort's free_sort_tuple function · a92709fe
      David Rowley authored
      41469253e went to the trouble of removing a theoretical bug from
      free_sort_tuple by checking if the tuple was NULL before freeing it. Let's
      make this a little more robust by also setting the tuple to NULL so that
      should we be called again we won't end up doing a pfree on the already
      pfree'd tuple. Per advice from Tom Lane.
      
      Discussion: https://postgr.es/m/3188192.1626136953@sss.pgh.pa.us
      Backpatch-through: 9.6, same as 41469253e
      a92709fe
    • David Rowley's avatar
      Fix theoretical bug in tuplesort · a3b8d91c
      David Rowley authored
      This fixes a theoretical bug in tuplesort.c which, if a bounded sort was
      used in combination with a byval Datum sort (tuplesort_begin_datum), when
      switching the sort to a bounded heap in make_bounded_heap(), we'd call
      free_sort_tuple().  The problem was that when sorting Datums of a byval
      type, the tuple is NULL and free_sort_tuple() would free the memory for it
      regardless of that.  This would result in a crash.
      
      Here we fix that simply by adding a check to see if the tuple is NULL
      before trying to disassociate and free any memory belonging to it.
      
      The reason this bug is only theoretical is that nowhere in the current
      code base do we do tuplesort_set_bound() when performing a Datum sort.
      However, let's backpatch a fix for this as if any extension uses the code
      in this way then it's likely to cause problems.
      
      Author: Ronan Dunklau
      Discussion: https://postgr.es/m/CAApHDvpdoqNC5FjDb3KUTSMs5dg6f+XxH4Bg_dVcLi8UYAG3EQ@mail.gmail.com
      Backpatch-through: 9.6, oldest supported version
      a3b8d91c
  11. 12 Jul, 2021 6 commits
    • Tom Lane's avatar
      Probe for preadv/pwritev in a more macOS-friendly way. · e75da4f1
      Tom Lane authored
      Apple's mechanism for dealing with functions that are available
      in only some OS versions confuses AC_CHECK_FUNCS, and therefore
      AC_REPLACE_FUNCS.  We can use AC_CHECK_DECLS instead, so long as
      we enable -Werror=unguarded-availability-new.  This allows people
      compiling for macOS to control whether or not preadv/pwritev are
      used by setting MACOSX_DEPLOYMENT_TARGET, rather than supplying
      a back-rev SDK.  (Of course, the latter still works, too.)
      
      James Hilliard
      
      Discussion: https://postgr.es/m/20210122193230.25295-1-james.hilliard1@gmail.com
      e75da4f1
    • Peter Eisentraut's avatar
      doc: Fix typo in function prototype · 9b450b1f
      Peter Eisentraut authored
      9b450b1f
    • Heikki Linnakangas's avatar
      Remove dead assignment to local variable. · 23328080
      Heikki Linnakangas authored
      This should have been removed in commit 7e30c186, which split the loop
      into two. Only the first loop uses the 'from' variable; updating it in
      the second loop is bogus. It was never read after the first loop, so this
      was harmless and surely optimized away by the compiler, but let's be tidy.
      
      Backpatch to all supported versions.
      
      Author: Ranier Vilela
      Discussion: https://www.postgresql.org/message-id/CAEudQAoWq%2BAL3BnELHu7gms2GN07k-np6yLbukGaxJ1vY-zeiQ%40mail.gmail.com
      23328080
    • Peter Eisentraut's avatar
      doc: Make release note entries more accurate · 166fcf4a
      Peter Eisentraut authored
      Two tsquery-related release note entries had inaccuracies in the
      before and after examples.  Clean that up.
      166fcf4a
    • Michael Paquier's avatar
      Revert "Fix issues with Windows' stat() for files pending on deletion" · 5e60237a
      Michael Paquier authored
      This reverts commit 54fb8c7, as per the issues reported by fairywren
      when it comes to MinGW because of the lack of microsoft_native_stat()
      there.  Using just stat() for MSVC is not sufficient to take care of the
      concurrency problems with files pending on deletion.  It may be possible
      to paint some __MINGW64__ in the code to switch to a different
      implementation of stat() in this build context, but I am not sure either
      if relying on the implementation of stat() in MinGW to take care of the
      problems we are trying to fix is enough or not.  So this needs more
      study.
      
      Discussion: https://postgr.es/m/YOvOlfRrIO0yGtgw@paquier.xyz
      Backpatch-through: 14
      5e60237a
    • Michael Paquier's avatar
      Fix issues with Windows' stat() for files pending on deletion · de1510e2
      Michael Paquier authored
      The code introduced by bed90759 to enhance the stat() implementation on
      Windows for file sizes larger than 4GB fails to properly detect files
      pending for deletion with its method based on NtQueryInformationFile()
      or GetFileInformationByHandleEx(), as proved by Alexander Lakhin in a
      custom TAP test of his own.
      
      The method used in the implementation of open() to sleep and loop when
      when failing on ERROR_ACCESS_DENIED (EACCES) is showing much more
      stability, so switch to this method.  This could still lead to issues if
      the permission problem stays around for much longer than the timeout of
      1 second used, but that should (hopefully) never happen in
      performance-critical paths.  Still, there could be a point in increasing
      the timeouts for the sake of machines that handle heavy loads.
      
      Note that WIN32's open() now uses microsoft_native_stat() as it should
      be similar to stat() when working around issues with concurrent file
      deletions.
      
      I have spent some time testing this patch with pgbench in combination
      of the SQL functions from genfile.c, as well as running the TAP test
      provided on the thread with MSVC builds, and this looks much more
      stable than the previous method.
      
      Author: Alexander Lakhin
      Reviewed-by: Tom Lane, Michael Paquier,	Justin Pryzby
      Discussion: https://postgr.es/m/c3427edf-d7c0-ff57-90f6-b5de3bb62709@gmail.com
      Backpatch-through: 14
      de1510e2
  12. 11 Jul, 2021 2 commits