1. 04 Mar, 2019 2 commits
    • Michael Paquier's avatar
      Fix error handling of readdir() port implementation on first file lookup · 754b90f6
      Michael Paquier authored
      The implementation of readdir() in src/port/ which gets used by MSVC has
      been added in 399a36a7, and since the beginning it considers all errors
      on the first file lookup as ENOENT, setting errno accordingly and
      letting the routine caller think that the directory is empty.  While
      this is normally enough for the case of the backend, this can confuse
      callers of this routine on Windows as all errors would map to the same
      behavior.  So, for example, even permission errors would be thought as
      having an empty directory, while there could be contents in it.
      
      This commit changes the error handling so as readdir() gets a behavior
      similar to native implementations: force errno=0 when seeing
      ERROR_FILE_NOT_FOUND as error and consider other errors as plain
      failures.
      
      While looking at the patch, I noticed that MinGW does not enforce
      errno=0 when looking at the first file, but it gets enforced on the next
      file lookups.  A comment related to that was incorrect in the code.
      
      Reported-by: Yuri Kurenkov
      Diagnosed-by: Yuri Kurenkov, Grigory Smolkin
      Author:	Konstantin Knizhnik
      Reviewed-by: Andrew Dunstan, Michael Paquier
      Discussion: https://postgr.es/m/2cad7829-8d66-e39c-b937-ac825db5203d@postgrespro.ru
      Backpatch-through: 9.4
      754b90f6
    • Andrew Dunstan's avatar
      fix thinko in logrotate test · 5bd9160f
      Andrew Dunstan authored
      5bd9160f
  2. 03 Mar, 2019 4 commits
    • Andrew Dunstan's avatar
      Don't do pg_ctl logrotate test on Windows · d611175e
      Andrew Dunstan authored
      The test crashes and burns quite badly, for some reason, but even if it
      didn't it wouldn't work, since Windows doesn't let you rename a file
      held by a running process.
      d611175e
    • Tom Lane's avatar
      Improve performance of index-only scans with many index columns. · 80b9e9c4
      Tom Lane authored
      StoreIndexTuple was a loop over index_getattr, which is O(N^2)
      if the index columns are variable-width, and the performance
      impact is already quite visible at ten columns.  The obvious
      move is to replace that with a call to index_deform_tuple ...
      but that's *also* a loop over index_getattr.  Improve it to
      be essentially a clone of heap_deform_tuple.
      
      (There are a few other places that loop over all index columns
      with index_getattr, and perhaps should be changed likewise,
      but most of them don't seem performance-critical.  Anyway, the
      rest would mostly only be interested in the index key columns,
      which there aren't likely to be so many of.  Wide index tuples
      are a new thing with INCLUDE.)
      
      Konstantin Knizhnik
      
      Discussion: https://postgr.es/m/e06b2d27-04fc-5c0e-bb8c-ecd72aa24959@postgrespro.ru
      80b9e9c4
    • 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
  3. 02 Mar, 2019 2 commits
  4. 01 Mar, 2019 9 commits
  5. 28 Feb, 2019 15 commits
  6. 27 Feb, 2019 8 commits