1. 03 Mar, 2019 2 commits
    • Andrew Dunstan's avatar
      Avoid accidental wildcard expansion in msys shell · 78b408a2
      Andrew Dunstan authored
      Commit f092de05 added a test for pg_dumpall --exclude-database including
      the wildcard pattern '*dump*' which matches some files in the source
      directory. The test library on msys uses the shell which expands this
      and thus the program gets incorrect arguments. This doesn't happen if
      the pattern doesn't match any files, so here the pattern is set to
      '*dump_test*' which is such a pattern.
      
      Per buildfarm animal jacana.
      78b408a2
    • Dean Rasheed's avatar
      Further fixing for multi-row VALUES lists for updatable views. · ed4653db
      Dean Rasheed authored
      Previously, rewriteTargetListIU() generated a list of attribute
      numbers from the targetlist, which were passed to rewriteValuesRTE(),
      which expected them to contain the same number of entries as there are
      columns in the VALUES RTE, and to be in the same order. That was fine
      when the target relation was a table, but for an updatable view it
      could be broken in at least three different ways ---
      rewriteTargetListIU() could insert additional targetlist entries for
      view columns with defaults, the view columns could be in a different
      order from the columns of the underlying base relation, and targetlist
      entries could be merged together when assigning to elements of an
      array or composite type. As a result, when recursing to the base
      relation, the list of attribute numbers generated from the rewritten
      targetlist could no longer be relied upon to match the columns of the
      VALUES RTE. We got away with that prior to 41531e42 because it used
      to always be the case that rewriteValuesRTE() did nothing for the
      underlying base relation, since all DEFAULTS had already been replaced
      when it was initially invoked for the view, but that was incorrect
      because it failed to apply defaults from the base relation.
      
      Fix this by examining the targetlist entries more carefully and
      picking out just those that are simple Vars referencing the VALUES
      RTE. That's sufficient for the purposes of rewriteValuesRTE(), which
      is only responsible for dealing with DEFAULT items in the VALUES
      RTE. Any DEFAULT item in the VALUES RTE that doesn't have a matching
      simple-Var-assignment in the targetlist is an error which we complain
      about, but in theory that ought to be impossible.
      
      Additionally, move this code into rewriteValuesRTE() to give a clearer
      separation of concerns between the 2 functions. There is no need for
      rewriteTargetListIU() to know about the details of the VALUES RTE.
      
      While at it, fix the comment for rewriteValuesRTE() which claimed that
      it doesn't support array element and field assignments --- that hasn't
      been true since a3c7a993 (9.6 and later).
      
      Back-patch to all supported versions, with minor differences for the
      pre-9.6 branches, which don't support array element and field
      assignments to the same column in multi-row VALUES lists.
      
      Reviewed by Amit Langote.
      
      Discussion: https://postgr.es/m/15623-5d67a46788ec8b7f@postgresql.org
      ed4653db
  2. 02 Mar, 2019 2 commits
  3. 01 Mar, 2019 9 commits
  4. 28 Feb, 2019 15 commits
  5. 27 Feb, 2019 9 commits
  6. 26 Feb, 2019 3 commits
    • Robert Haas's avatar
      Change lock acquisition order in expand_inherited_rtentry. · f4b6341d
      Robert Haas authored
      Previously, this function acquired locks in the order using
      find_all_inheritors(), which locks the children of each table that it
      processes in ascending OID order, and which processes the inheritance
      hierarchy as a whole in a breadth-first fashion.  Now, it processes
      the inheritance hierarchy in a depth-first fashion, and at each level
      it proceeds in the order in which tables appear in the PartitionDesc.
      If table inheritance rather than table partitioning is used, the old
      order is preserved.
      
      This change moves the locking of any given partition much closer to
      the code that actually expands that partition.  This seems essential
      if we ever want to allow concurrent DDL to add or remove partitions,
      because if the set of partitions can change, we must use the same data
      to decide which partitions to lock as we do to decide which partitions
      to expand; otherwise, we might expand a partition that we haven't
      locked.  It should hopefully also facilitate efforts to postpone
      inheritance expansion or locking for performance reasons, because
      there's really no way to postpone locking some partitions if
      we're blindly locking them all using find_all_inheritors().
      
      The only downside of this change which is known to me is that it
      further deviates from the principle that we should always lock the
      inheritance hierarchy in find_all_inheritors() order to avoid deadlock
      risk.  However, we've already crossed that bridge in commit
      9eefba18 and there are futher patches
      pending that make similar changes, so this isn't really giving up
      anything that we haven't surrendered already -- and it seems entirely
      worth it, given the performance benefits some of those changes seem
      likely to bring.
      
      Patch by me; thanks to David Rowley for discussion of these issues.
      
      Discussion: http://postgr.es/m/CAKJS1f_eEYVEq5tM8sm1k-HOwG0AyCPwX54XG9x4w0zy_N4Q_Q@mail.gmail.com
      Discussion: http://postgr.es/m/CA+TgmoZUwPf_uanjF==gTGBMJrn8uCq52XYvAEorNkLrUdoawg@mail.gmail.com
      f4b6341d
    • Michael Meskes's avatar
      Free memory in ecpg bytea regression test. · 42ccbe43
      Michael Meskes authored
      While not really a problem it's easier to run tools like valgrind against it
      when fixed.
      42ccbe43
    • Michael Meskes's avatar