1. 04 May, 2018 7 commits
    • Andrew Dunstan's avatar
      Allow MSYS as well as MINGW in Msys uname · 608a7101
      Andrew Dunstan authored
      Msys2's uname -s outputs a string beginning MSYS rather than MINGW as is
      output by Msys. Allow either in pg_upgrade's test.sh.
      
      Backpatch to all live branches.
      608a7101
    • Tom Lane's avatar
      Sync our copy of the timezone library with IANA release tzcode2018e. · b45f6613
      Tom Lane authored
      The non-cosmetic changes involve teaching the "zic" tzdata compiler about
      negative DST.  While I'm not currently intending that we start using
      negative-DST data right away, it seems possible that somebody would try
      to use our copy of zic with bleeding-edge IANA data.  So we'd better be
      out in front of this change code-wise, even though it doesn't matter for
      the data file we're shipping.
      
      Discussion: https://postgr.es/m/30996.1525445902@sss.pgh.pa.us
      b45f6613
    • Tom Lane's avatar
      Fix precedence problem in new Perl code. · 59cb3230
      Tom Lane authored
      I think this bit of commit 1f1cd9b5 didn't do quite what I meant :-(
      59cb3230
    • Peter Eisentraut's avatar
      pg_dump: Use current_database() instead of PQdb() · 1cd2445c
      Peter Eisentraut authored
      For querying pg_database about information about the database being
      dumped, look up by using current_database() instead of the value
      obtained from PQdb().  When using a connection proxy, the value from
      PQdb() might not be the real name of the database.
      1cd2445c
    • Teodor Sigaev's avatar
      Don't truncate away non-key attributes for leftmost downlinks. · 2a9e04f0
      Teodor Sigaev authored
      nbtsort.c does not need to truncate away non-key attributes for the
      minimum key of the leftmost page on a level, since this is only used to
      build a minus infinity downlink for the level's leftmost page.
      Truncating away non-key attributes in advance of truncating away all
      attributes in _bt_sortaddtup() does not affect the correctness of CREATE
      INDEX, but it is misleading.
      
      Author: Peter Geoghegan
      Discussion: https://www.postgresql.org/message-id/CAH2-WzkAS2M3ussHG-s_Av=Zo6dPjOxyu5fNRkYnxQV+YzGQ4w@mail.gmail.com
      2a9e04f0
    • Teodor Sigaev's avatar
      Re-think predicate locking on GIN indexes. · 0bef1c06
      Teodor Sigaev authored
      The principle behind the locking was not very well thought-out, and not
      documented. Add a section in the README to explain how it's supposed to
      work, and change the code so that it actually works that way.
      
      This fixes two bugs:
      
      1. If fast update was turned on concurrently, subsequent inserts to the
         pending list would not conflict with predicate locks that were acquired
         earlier, on entry pages. The included 'predicate-gin-fastupdate' test
         demonstrates that. To fix, make all scans acquire a predicate lock on
         the metapage. That lock represents a scan of the pending list, whether
         or not there is a pending list at the moment. Forget about the
         optimization to skip locking/checking for locks, when fastupdate=off.
      2. If a scan finds no match, it still needs to lock the entry page. The
         point of predicate locks is to lock the gabs between values, whether
         or not there is a match. The included 'predicate-gin-nomatch' test
         tests that case.
      
      In addition to those two bug fixes, this removes some unnecessary locking,
      following the principle laid out in the README. Because all items in
      a posting tree have the same key value, a lock on the posting tree root is
      enough to cover all the items. (With a very large posting tree, it would
      possibly be better to lock the posting tree leaf pages instead, so that a
      "skip scan" with a query like "A & B", you could avoid unnecessary conflict
      if a new tuple is inserted with A but !B. But let's keep this simple.)
      
      Also, some spelling  fixes.
      
      Author: Heikki Linnakangas with some editorization by me
      Review: Andrey Borodin, Alexander Korotkov
      Discussion: https://www.postgresql.org/message-id/0b3ad2c2-2692-62a9-3a04-5724f2af9114@iki.fi
      0bef1c06
    • Peter Eisentraut's avatar
      Update expected files for older Python versions · 7d867997
      Peter Eisentraut authored
      neglected in commit fa03769e
      7d867997
  2. 03 May, 2018 10 commits
    • Tom Lane's avatar
      Blindly try to fix MSVC build's use of genbki.pl and Gen_fmgrtab.pl. · bad51a49
      Tom Lane authored
      We need to use a stamp file to record the runs of these scripts, as
      is done on the Unix side.  I think I got it right, but can't test.
      
      While at it, extend this handmade dependency logic to also check the
      generating script files, as the makefiles do.
      
      Discussion: https://postgr.es/m/16925.1525376229@sss.pgh.pa.us
      bad51a49
    • Tom Lane's avatar
      Avoid overwriting unchanged output files in genbki.pl and Gen_fmgrtab.pl. · 1f1cd9b5
      Tom Lane authored
      If a particular output file already exists with the contents it should
      have, leave it alone, so that its mod timestamp is not advanced.
      
      In builds using --enable-depend, this can avoid the need to recompile .c
      files whose included files didn't actually change.  It's not clear whether
      it saves much of anything for users of ccache; but the cost of doing the
      file comparisons seems to be negligible, so we might as well do it.
      
      For developers using the MSVC toolchain, this will create a regression:
      msvc/Solution.pm will sometimes run genbki.pl or Gen_fmgrtab.pl
      unnecessarily.  I'll look into fixing that separately.
      
      Discussion: https://postgr.es/m/16925.1525376229@sss.pgh.pa.us
      1f1cd9b5
    • Tom Lane's avatar
      Rearrange makefile rules for running Gen_fmgrtab.pl. · 9bf28f96
      Tom Lane authored
      Make these rules look more like the ones associated with genbki.pl,
      to wit:
      
      * Use a stamp file to record when we last ran the script, instead of
      relying on the timestamps of the individual output files.
      
      * Take the knowledge out of backend/Makefile and put it in utils/Makefile
      where it belongs.  I moved down the handling of errcodes.h and probes.h
      too, although those continue to be built by separate processes.
      
      In itself, this is just much-needed cleanup with little practical effect.
      However, by decoupling these makefile rules from the timestamps of the
      generated header files, we open the door to not advancing those timestamps
      unnecessarily, which will be taken advantage of by the next commit.
      
      msvc/Solution.pm should be taught to do things similarly, but I'll leave
      that for another commit.
      
      Discussion: https://postgr.es/m/16925.1525376229@sss.pgh.pa.us
      9bf28f96
    • Peter Eisentraut's avatar
      Tweak tests to support Python 3.7 · fa03769e
      Peter Eisentraut authored
      Python 3.7 removes the trailing comma in the repr() of
      BaseException (see <https://bugs.python.org/issue30399>), leading to
      test output differences.  Work around that by composing the equivalent
      test output in a more manual way.
      fa03769e
    • Teodor Sigaev's avatar
      Add HOLD_INTERRUPTS section into FinishPreparedTransaction. · 8f9be261
      Teodor Sigaev authored
      If an interrupt arrives in the middle of FinishPreparedTransaction
      and any callback decide to call CHECK_FOR_INTERRUPTS (e.g.
      RemoveTwoPhaseFile can write a warning with ereport, which checks for
      interrupts) then it's possible to leave current GXact undeleted.
      
      Backpatch to all supported branches
      
      Stas Kelvich
      
      Discussion: ihttps://www.postgresql.org/message-id/3AD85097-A3F3-4EBA-99BD-C38EDF8D2949@postgrespro.ru
      8f9be261
    • Tom Lane's avatar
      Avoid portability issues in autoprewarm.c. · cddc4dc6
      Tom Lane authored
      autoprewarm.c mostly considered the number of blocks it might be dealing
      with as being int64.  This is unnecessary, because NBuffers is declared
      as int, and there's been no suggestion that we might widen it in the
      foreseeable future.  Moreover, using int64 is problematic because the
      code expected INT64_FORMAT to work with fscanf(), something we don't
      guarantee, and which indeed fails on some older buildfarm members.
      
      On top of that, the module randomly used uint32 rather than int64 variables
      to hold block counters in several places, so it would fail anyway if we
      ever did have NBuffers wider than that; and it also supposed that pg_qsort
      could sort an int64 number of elements, which is wrong on 32-bit machines
      (though no doubt a 32-bit machine couldn't actually have that many
      buffers).
      
      Hence, change all these variables to plain int.
      
      In passing, avoid shadowing one variable named i with another,
      and avoid casting away const in apw_compare_blockinfo.
      
      Discussion: https://postgr.es/m/7773.1525288909@sss.pgh.pa.us
      cddc4dc6
    • Teodor Sigaev's avatar
      Fix pg_dump support for pre-8.2 versions · ac7a7e32
      Teodor Sigaev authored
      Unify indnkeys/indnatts/indnkeyatts usage  for all version of query to get
      index information, remove indnkeys column  from query as unused.
      
      Author: Marina Polyakova
      Noticed by: Peter Eisentraut
      ac7a7e32
    • Tom Lane's avatar
      Further improve code for probing the availability of ARM CRC instructions. · a7a73875
      Tom Lane authored
      Andrew Gierth pointed out that commit 1c72ec6f would yield the wrong
      answer on big-endian ARM systems, because the data being CRC'd would be
      different.  To fix that, and avoid the rather unsightly hard-wired
      constant, simply compare the hardware and software implementations'
      results.
      
      While we're at it, also log the resulting decision at DEBUG1, and error
      out if the hw and sw results unexpectedly differ.  Also, since this
      file must compile for both frontend and backend, avoid incorrect
      dependencies on backend-only headers.
      
      In passing, add a comment to postmaster.c about when the CRC function
      pointer will get initialized.
      
      Thomas Munro, based on complaints from Andrew Gierth and Tom Lane
      
      Discussion: https://postgr.es/m/HE1PR0801MB1323D171938EABC04FFE7FA9E3110@HE1PR0801MB1323.eurprd08.prod.outlook.com
      a7a73875
    • Peter Eisentraut's avatar
      Fix SPI error cleanup and memory leak · 30c66e77
      Peter Eisentraut authored
      Since the SPI stack has been moved from TopTransactionContext to
      TopMemoryContext, setting _SPI_stack to NULL in AtEOXact_SPI() leaks
      memory.  In fact, we don't need to do that anymore: We just leave the
      allocated stack around for the next SPI use.
      
      Also, refactor the SPI cleanup so that it is run both at transaction end
      and when returning to the main loop on an exception.  The latter is
      necessary when a procedure calls a COMMIT or ROLLBACK command that
      itself causes an error.
      30c66e77
    • Robert Haas's avatar
      Remove now-unnecessary cast. · a365f52d
      Robert Haas authored
      Etsuro Fujita
      
      Discussion: http://postgr.es/m/5AE99BA7.9060001@lab.ntt.co.jp
      a365f52d
  3. 02 May, 2018 12 commits
  4. 01 May, 2018 11 commits