1. 18 Dec, 2019 8 commits
  2. 17 Dec, 2019 14 commits
  3. 16 Dec, 2019 6 commits
  4. 15 Dec, 2019 1 commit
  5. 14 Dec, 2019 5 commits
    • Tom Lane's avatar
      Try to stabilize results of new tuplesort regression test. · baa32ce2
      Tom Lane authored
      It appears that a concurrent autovacuum/autoanalyze run can cause
      changes in the plans expected by this test.  To prevent that, change
      the tables it uses to be temp tables --- there's no need for them
      to be permanent, and this should save a few cycles too.
      
      Discussion: https://postgr.es/m/3244.1576160824@sss.pgh.pa.us
      baa32ce2
    • Tom Lane's avatar
      Prevent overly-aggressive collapsing of joins to RTE_RESULT relations. · 6ea364e7
      Tom Lane authored
      The RTE_RESULT simplification logic added by commit 4be058fe had a
      flaw: it would collapse out a RTE_RESULT that is due to compute a
      PlaceHolderVar, and reassign the PHV to the parent join level, even if
      another input relation of the join contained a lateral reference to
      the PHV.  That can't work because the PHV would be computed too late.
      In practice it led to failures of internal sanity checks later in
      planning (either assertion failures or errors such as "failed to
      construct the join relation").
      
      To fix, add code to check for the presence of such PHVs in relevant
      portions of the query tree.  Notably, this required refactoring
      range_table_walker so that a caller could ask to walk individual RTEs
      not the whole list.  (It might be a good idea to refactor
      range_table_mutator in the same way, if only to keep those functions
      looking similar; but I didn't do so here as it wasn't necessary for
      the bug fix.)
      
      This exercise also taught me that find_dependent_phvs(), as it stood,
      could only safely be used on the entire Query, not on subtrees.
      Adjust its API to reflect that; which in passing allows it to have
      a fast path for the common case of no PHVs anywhere.
      
      Per report from Will Leinweber.  Back-patch to v12 where the bug
      was introduced.
      
      Discussion: https://postgr.es/m/CALLb-4xJMd4GZt2YCecMC95H-PafuWNKcmps4HLRx2NHNBfB4g@mail.gmail.com
      6ea364e7
    • Michael Paquier's avatar
      Fix memory leak when initializing DH parameters in backend · e0e569e1
      Michael Paquier authored
      When loading DH parameters used for the generation of ephemeral DH keys
      in the backend, the code has never bothered releasing the memory used
      for the DH information loaded from a file or from libpq's default.  This
      commit makes sure that the information is properly free()'d.
      
      Note that as SSL parameters can be reloaded, this can cause an accumulation
      of memory leaked.  As the leak is minor, no backpatch is done.
      
      Reported-by: Dmitry Uspenskiy
      Discussion: https://postgr.es/m/16160-18367e56e9a28264@postgresql.org
      e0e569e1
    • Thomas Munro's avatar
      Fix mdsyncfiletag(), take II. · 7c85be08
      Thomas Munro authored
      The previous commit failed to consider that FileGetRawDesc() might
      not return a valid fd, as discovered on the build farm.  Switch to
      using the File interface only.
      
      Back-patch to 12, like the previous commit.
      7c85be08
    • Thomas Munro's avatar
      Don't use _mdfd_getseg() in mdsyncfiletag(). · 7bb3102c
      Thomas Munro authored
      _mdfd_getseg() opens all segments up to the requested one.  That
      causes problems for mdsyncfiletag(), if mdunlinkfork() has
      already unlinked other segment files.  Open the file we want
      directly by name instead, if it's not already open.
      
      The consequence of this bug was a rare panic in the checkpointer,
      made more likely if you saturated the sync request queue so that
      the SYNC_FORGET_REQUEST messages for a given relation were more
      likely to be absorbed in separate cycles by the checkpointer.
      
      Back-patch to 12.  Defect in commit 3eb77eba.
      
      Author: Thomas Munro
      Reported-by: Justin Pryzby
      Discussion: https://postgr.es/m/20191119115759.GI30362%40telsasoft.com
      7bb3102c
  6. 13 Dec, 2019 2 commits
    • Heikki Linnakangas's avatar
      Fix crash when a page was split during GiST index creation. · a7ee7c85
      Heikki Linnakangas authored
      The bug was similar to the one that was fixed in commit 22251686. When
      we split page X and insert the downlink for the new page, the parent page
      might also need to be split. When that happens, the downlink offset number
      we remembered for X is no longer valid. We correctly called
      gistFindCorrectParent() to re-find it, but gistFindCorrectParent() doesn't
      do anything if the LSN of the page hasn't changed, and we stopped updating
      LSNs during index build in commit 9155580f. The buggy codepath was taken
      if the page was split into three or more pages, and inserting the downlink
      caused the parent page to split. To fix, explicitly mark the downlink
      offset number as invalid, to force gistFindCorrectParent() to re-find it.
      
      Fixes bug #16134 reported by Alexander Lakhin, reported again as #16162 by
      Andreas Kunert. Thanks to Jeff Janes, Tom Lane and Tomas Vondra for
      debugging. Backpatch to v12, where we stopped WAL-logging during index
      build.
      
      Discussion: https://www.postgresql.org/message-id/16134-0423f729671dec64%40postgresql.org
      Discussion: https://www.postgresql.org/message-id/16162-45d21b7b6c1a3105%40postgresql.org
      a7ee7c85
    • Tom Lane's avatar
      Modernize our readline API a tad. · 5e7bedc5
      Tom Lane authored
      Prefer to call "rl_filename_completion_function" and
      "rl_completion_matches", rather than using the names without the rl_
      prefix.  This matches Readline's documentation, and makes our code
      a little clearer about which names are external.  On platforms that
      only have the un-prefixed names (just some very ancient versions of
      libedit, AFAICT), reverse the direction of the compatibility macro
      definitions to match.
      
      Also, remove our extern declaration of "filename_completion_function";
      whatever libedit versions may have failed to declare that are surely
      dead and buried.
      
      Discussion: https://postgr.es/m/23608.1576248145@sss.pgh.pa.us
      5e7bedc5
  7. 12 Dec, 2019 4 commits
    • Tom Lane's avatar
      Put back regression test case in a more robust form. · 22864f6e
      Tom Lane authored
      This undoes my hurried commit 776a2c88, restoring the removed test case
      in a form that passes with or without force_parallel_mode = regress.
      
      It turns out that force_parallel_mode = regress simply fails to mask
      the Worker lines that will be produced by EXPLAIN (ANALYZE, VERBOSE).
      I'd say that's a bug in that feature, as its entire alleged reason
      for existence is to make the EXPLAIN output the same.  It's certainly
      not a bug in the plan node pruning logic.  Fortunately, this test case
      doesn't really need to use ANALYZE, so just drop that.
      
      Discussion: https://postgr.es/m/18891.1576109690@sss.pgh.pa.us
      22864f6e
    • Tom Lane's avatar
      Fix EXTRACT(ISOYEAR FROM timestamp) for years BC. · 1a3efa1e
      Tom Lane authored
      The test cases added by commit 26ae3aa8 exposed an old oversight in
      timestamp[tz]_part: they didn't correct the result of date2isoyear()
      for BC years, so that we produced an off-by-one answer for such years.
      Fix that, and back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/SG2PR06MB37762CAE45DB0F6CA7001EA9B6550@SG2PR06MB3776.apcprd06.prod.outlook.com
      1a3efa1e
    • Tom Lane's avatar
      Remove redundant function calls in timestamp[tz]_part(). · 26ae3aa8
      Tom Lane authored
      The DTK_DOW/DTK_ISODOW and DTK_DOY switch cases in timestamp_part() and
      timestamptz_part() contained calls of timestamp2tm() that were fully
      redundant with the ones done just above the switch.  This evidently crept
      in during commit 258ee1b6, which relocated that code from another place
      where the calls were indeed needed.  Just delete the redundant calls.
      
      I (tgl) noted that our test coverage of these functions left quite a
      bit to be desired, so extend timestamp.sql and timestamptz.sql to
      cover all the branches.
      
      Back-patch to all supported branches, as the previous commit was.
      There's no real issue here other than some wasted cycles in some
      not-too-heavily-used code paths, but the test coverage seems valuable.
      
      Report and patch by Li Japin; test case adjustments by me.
      
      Discussion: https://postgr.es/m/SG2PR06MB37762CAE45DB0F6CA7001EA9B6550@SG2PR06MB3776.apcprd06.prod.outlook.com
      26ae3aa8
    • Alvaro Herrera's avatar
      (Blindly) tweak new test regex · 8ed428dc
      Alvaro Herrera authored
      gcc-based Windows buildfarm animals are not happy about a multiline
      regular expression I added recently.  Try to accomodate; existing
      pg_basebackup tests suggest that \n should work instead of a bare
      newline, but throw in \r also.  This being perl, TIMTOWTDI.
      Also remove the pointless $ at the end of the pattern, for extra luck.
      
      (If this doesn't work, I'll probably just split the regex in two.)
      
      Per buildfarm members jacana and fairywren.
      
      Discussion: https://postgr.es/m/3562.1576161217@sss.pgh.pa.us
      8ed428dc