1. 27 Jul, 2018 3 commits
    • Robert Haas's avatar
      Use key and partdesc from PartitionDispatch where possible. · 3e321090
      Robert Haas authored
      Instead of repeatedly fishing the data out of the relcache entry,
      let's use the version that we cached in the PartitionDispatch.  We
      could alternatively rip out the PartitionDispatch fields altogether,
      but it doesn't make much sense to have them and not use them; before
      this patch, partdesc was set but altogether unused.  Amit Langote and
      I both thought using them was a litle better than removing them, so
      this patch takes that approach.
      
      Discussion: http://postgr.es/m/CA+TgmobFnxcaW-Co-XO8=yhJ5pJXoNkCj6Z7jm9Mwj9FGv-D7w@mail.gmail.com
      3e321090
    • Amit Kapila's avatar
      Fix the buffer release order for parallel index scans. · 8ce29bb4
      Amit Kapila authored
      During parallel index scans, if the current page to be read is deleted, we
      skip it and try to get the next page for a scan without releasing the buffer
      lock on the current page.  To get the next page, sometimes it needs to wait
      for another process to complete its scan and advance it to the next page.
      Now, it is quite possible that the master backend has errored out before
      advancing the scan and issued a termination signal for all workers.  The
      workers failed to notice the termination request during wait because the
      interrupts are held due to buffer lock on the previous page.  This lead to
      all workers being stuck.
      
      The fix is to release the buffer lock on current page before trying to get
      the next page.  We are already doing same in backward scans, but missed
      it for forward scans.
      
      Reported-by: Victor Yegorov
      Bug: 15290
      Diagnosed-by: Thomas Munro and Amit Kapila
      Author: Amit Kapila
      Reviewed-by: Thomas Munro
      Tested-By: Thomas Munro and Victor Yegorov
      Backpatch-through: 10 where parallel index scans were introduced
      Discussion: https://postgr.es/m/153228422922.1395.1746424054206154747@wrigleys.postgresql.org
      8ce29bb4
    • Michael Paquier's avatar
      Fix handling of pgbench's hash when no argument is provided · 39d51fe8
      Michael Paquier authored
      Depending on the platform used, this can cause a crash in the worst
      case, or an unhelpful error message, so fail gracefully.
      
      Author: Fabien Coelho
      Discussion: https://postgr.es/m/alpine.DEB.2.21.1807262302550.29874@lancre
      Backpatch: 11-, where hash() has been added in pgbench.
      39d51fe8
  2. 26 Jul, 2018 2 commits
    • Tom Lane's avatar
      Provide plpgsql tests for cases involving record field changes. · 9f77ad26
      Tom Lane authored
      We suppressed one of these test cases in commit feb1cc55 because
      it was failing to produce the expected results on CLOBBER_CACHE_ALWAYS
      buildfarm members.  But now we need another test with similar behavior,
      so let's set up a test file that is expected to vary between regular and
      CLOBBER_CACHE_ALWAYS cases, and provide variant expected files.
      
      Someday we should fix plpgsql's failure for change-of-field-type, and
      then the discrepancy will go away and we can fold these tests back
      into plpgsql_record.sql.  But today is not that day.
      
      Discussion: https://postgr.es/m/87wotkfju1.fsf@news-spur.riddles.org.uk
      9f77ad26
    • Tom Lane's avatar
      Avoid crash in eval_const_expressions if a Param's type changes. · 662d12ae
      Tom Lane authored
      Since commit 6719b238 it's been possible for the values of plpgsql
      record field variables to be exposed to the planner as Params.
      (Before that, plpgsql never supplied values for such variables during
      planning, so that the problematic code wasn't reached.)  Other places
      that touch potentially-type-mutable Params either cope gracefully or
      do runtime-test-and-ereport checks that the type is what they expect.
      But eval_const_expressions() just had an Assert, meaning that it either
      failed the assertion or risked crashes due to using an incompatible
      value.
      
      In this case, rather than throwing an ereport immediately, we can just
      not perform a const-substitution in case of a mismatch.  This seems
      important for the same reason that the Param fetch was speculative:
      we might not actually reach this part of the expression at runtime.
      
      Test case will follow in a separate commit.
      
      Patch by me, pursuant to bug report from Andrew Gierth.
      Back-patch to v11 where the previous commit appeared.
      
      Discussion: https://postgr.es/m/87wotkfju1.fsf@news-spur.riddles.org.uk
      662d12ae
  3. 25 Jul, 2018 2 commits
  4. 24 Jul, 2018 8 commits
  5. 23 Jul, 2018 8 commits
  6. 22 Jul, 2018 2 commits
  7. 21 Jul, 2018 2 commits
    • Tom Lane's avatar
      Further portability hacking in pg_upgrade's test script. · 04269320
      Tom Lane authored
      I blew the dust off a Bourne shell (file date 1996, yea verily) and
      tried to run test.sh with it.  It mostly worked, but I found that the
      temp-directory creation code introduced by commit be76a6d3 was not
      compatible, for a couple of reasons: this shell thinks "set -e" should
      force an exit if a command within backticks fails, and it also thinks code
      within braces should be executed by a sub-shell, meaning that variable
      settings don't propagate back up to the parent shell.  In view of Victor
      Wagner's report that Solaris is still using pre-POSIX shells, seems like
      we oughta make this case work.  It's not like the code is any less
      idiomatic this way; the prior coding technique appeared nowhere else.
      
      (There is a remaining bash-ism here, which is that $RANDOM doesn't do
      what the code hopes in non-bash shells.  But the use of $$ elsewhere in
      that path should be enough to ensure uniqueness and some amount of
      randomness, so I think it's okay as-is.)
      
      Back-patch to all supported branches, as the previous commit was.
      
      Discussion: https://postgr.es/m/20180720153820.69e9ae6c@fafnir.local.vm
      04269320
    • Tom Lane's avatar
      Be more paranoid about quoting in pg_upgrade's test script. · 0c0908d9
      Tom Lane authored
      Double-quote $PGDATA in "find" commands introduced by commit da9b580d,
      in case that path contains spaces or other special characters.
      
      Adjust a few other places so that quoting is done more consistently.
      None of the others are actual bugs AFAICS, but it's confusing to readers
      if the same thing is done differently in different places.
      
      Noted by Tels.
      
      Discussion: https://postgr.es/m/c96303c04c360bbedaa04f90f515745b.squirrel@sm.webmail.pair.com
      0c0908d9
  8. 20 Jul, 2018 3 commits
  9. 19 Jul, 2018 10 commits