1. 28 Jul, 2018 4 commits
  2. 27 Jul, 2018 5 commits
  3. 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
  4. 25 Jul, 2018 2 commits
  5. 24 Jul, 2018 8 commits
  6. 23 Jul, 2018 8 commits
  7. 22 Jul, 2018 2 commits
  8. 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
  9. 20 Jul, 2018 3 commits
  10. 19 Jul, 2018 4 commits
    • Michael Paquier's avatar
      Add toast tables to most system catalogs · 96cdeae0
      Michael Paquier authored
      It has been project policy to create toast tables only for those catalogs
      that might reasonably need one.  Since this judgment call can change over
      time, just create one for every catalog, as this can be useful when
      creating rather-long entries in catalogs, with recent examples being in
      the shape of policy expressions or customly-formatted SCRAM verifiers.
      
      To prevent circular dependencies and to avoid adding complexity to VACUUM
      FULL logic, exclude pg_class, pg_attribute, and pg_index.  Also, to
      prevent pg_upgrade from seeing a non-empty new cluster, exclude
      pg_largeobject and pg_largeobject_metadata from the set as large object
      data is handled as user data.  Those relations have no reason to use a
      toast table anyway.
      
      Author: Joe Conway, John Naylor
      Reviewed-by: Michael Paquier, Tom Lane
      Discussion: https://postgr.es/m/84ddff04-f122-784b-b6c5-3536804495f8@joeconway.com
      96cdeae0
    • Tom Lane's avatar
      Remove undocumented restriction against duplicate partition key columns. · 24097167
      Tom Lane authored
      transformPartitionSpec rejected duplicate simple partition columns
      (e.g., "PARTITION BY RANGE (x,x)") but paid no attention to expression
      columns, resulting in inconsistent behavior.  Worse, cases like
      "PARTITION BY RANGE (x,(x))") were accepted but would then result in
      dump/reload failures, since the expression (x) would get simplified
      to a plain column later.
      
      There seems no better reason for this restriction than there was for
      the one against duplicate included index columns (cf commit 701fd0bb),
      so let's just remove it.
      
      Back-patch to v10 where this code was added.
      
      Report and patch by Yugo Nagata.
      
      Discussion: https://postgr.es/m/20180712165939.36b12aff.nagata@sraoss.co.jp
      24097167
    • Tom Lane's avatar
      Improve psql's \d command to show whether index columns are key columns. · 90371a24
      Tom Lane authored
      This is essential information when looking at an index that has
      "included" columns.  Per discussion, follow the style used in \dC
      and some other places: column header is "Key?" and values are "yes"
      or "no" (all translatable).
      
      While at it, revise describeOneTableDetails to be a bit more maintainable:
      avoid hard-wired column numbers and multiple repetitions of what needs
      to be identical test logic.  This also results in the emitted catalog
      query corresponding more closely to what we print, which should be a
      benefit to users of ECHO_HIDDEN mode, and perhaps a bit faster too
      (the old logic sometimes asked for values it would not print, even
      ones that are fairly expensive to get).
      
      Discussion: https://postgr.es/m/21724.1531943735@sss.pgh.pa.us
      90371a24
    • Tom Lane's avatar
      Fix pg_get_indexdef()'s behavior for included index columns. · 028e3da2
      Tom Lane authored
      The multi-argument form of pg_get_indexdef() failed to print anything when
      asked to print a single index column that is an included column rather than
      a key column.  This seems an unintentional result of someone having tried
      to take a short-cut and use the attrsOnly flag for two different purposes.
      To fix, split said flag into two flags, attrsOnly which suppresses
      non-attribute info, and keysOnly which suppresses included columns.
      Add a test case using psql's \d command, which relies on that function.
      
      (It's mighty tempting at this point to replace pg_get_indexdef_worker's
      mess of boolean flag arguments with a single bitmask-of-flags argument,
      which would allow making the call sites much more self-documenting.
      But I refrained for the moment.)
      
      Discussion: https://postgr.es/m/21724.1531943735@sss.pgh.pa.us
      028e3da2