1. 06 May, 2016 3 commits
  2. 05 May, 2016 6 commits
    • Tom Lane's avatar
      Rename tsvector delete() to ts_delete(), and filter() to ts_filter(). · 0b9a2344
      Tom Lane authored
      The similarity of the original names to SQL keywords seems like a bad
      idea.  Rename them before we're stuck with 'em forever.
      
      In passing, minor code and docs cleanup.
      
      Discussion: <4875.1462210058@sss.pgh.pa.us>
      0b9a2344
    • Tom Lane's avatar
      Small 9.6 release note improvements. · 2f38b986
      Tom Lane authored
      Sync release notes through today, and incorporate some suggestions
      from Robert Haas.
      2f38b986
    • Tom Lane's avatar
      Rename pgbench min/max to least/greatest, and fix handling of double args. · 7a622b27
      Tom Lane authored
      These functions behave like the backend's least/greatest functions,
      not like min/max, so the originally-chosen names invite confusion.
      Per discussion, rename to least/greatest.
      
      I also took it upon myself to make them return double if any input is
      double.  The previous behavior of silently coercing all inputs to int
      surely does not meet the principle of least astonishment.
      
      Copy-edit some of the other new functions' documentation, too.
      7a622b27
    • Tom Lane's avatar
      First-draft release notes for Postgres 9.6. · c311f788
      Tom Lane authored
      These are just of beta quality, but we're only at beta ... the section
      about parallel query, in particular, could doubtless use more work.
      c311f788
    • Tom Lane's avatar
      Fix ordering/categorization of some recently-added system views. · a9ba6195
      Tom Lane authored
      Somebody added pg_replication_origin, pg_replication_origin_status and
      pg_replication_slots to catalogs.sgml without a whole lot of concern for
      either alphabetical order or the difference between a table and a view.
      Clean up the mess.
      
      Back-patch to 9.5, not so much because this is critical as because if
      I don't it will result in a cross-branch divergence in release-9.5.sgml,
      which would be a maintenance hazard.
      a9ba6195
    • Dean Rasheed's avatar
      Fix corner-case loss of precision in numeric pow() calculation · 18a02ad2
      Dean Rasheed authored
      Commit 7d9a4737 greatly improved the
      accuracy of the numeric transcendental functions, however it failed to
      consider the case where the result from pow() is close to the overflow
      threshold, for example 0.12 ^ -2345.6. For such inputs, where the
      result has more than 2000 digits before the decimal point, the decimal
      result weight estimate was being clamped to 2000, leading to a loss of
      precision in the final calculation.
      
      Fix this by replacing the clamping code with an overflow test that
      aborts the calculation early if the final result is sure to overflow,
      based on the overflow limit in exp_var(). This provides the same
      protection against integer overflow in the subsequent result scale
      computation as the original clamping code, but it also ensures that
      precision is never lost and saves compute cycles in cases that are
      sure to overflow.
      
      The new early overflow test works with the initial low-precision
      result (expected to be accurate to around 8 significant digits) and
      includes a small fuzz factor to ensure that it doesn't kick in for
      values that would not overflow exp_var(), so the overall overflow
      threshold of pow() is unchanged and consistent for all inputs with
      non-integer exponents.
      
      Author: Dean Rasheed
      Reviewed-by: Tom Lane
      Discussion: http://www.postgresql.org/message-id/CAEZATCUj3U-cQj0jjoia=qgs0SjE3auroxh8swvNKvZWUqegrg@mail.gmail.com
      See-also: http://www.postgresql.org/message-id/CAEZATCV7w+8iB=07dJ8Q0zihXQT1semcQuTeK+4_rogC_zq5Hw@mail.gmail.com
      18a02ad2
  3. 04 May, 2016 5 commits
    • Alvaro Herrera's avatar
      Revert timeline following in replication slots · c1543a81
      Alvaro Herrera authored
      This reverts commits f07d18b6, 82c83b33, 3a3b3090, and
      24c5f1a1.
      
      This feature has shown enough immaturity that it was deemed better to
      rip it out before rushing some more fixes at the last minute.  There are
      discussions on larger changes in this area for the next release.
      c1543a81
    • Peter Eisentraut's avatar
      doc: Fix more typos · 6535bf39
      Peter Eisentraut authored
      From: Alexander Law <exclusion@gmail.com>
      6535bf39
    • Teodor Sigaev's avatar
      Fix crash of filter(tsvector) · 4bbc1a7e
      Teodor Sigaev authored
      Variable storing a position of lexeme, had a wrong type: char, it's
      obviously not enough to store 2^14 possible positions.
      
      Stas Kelvich
      4bbc1a7e
    • Andres Freund's avatar
      Fix transient mdsync() errors of truncated relations due to 72a98a63. · a7124870
      Andres Freund authored
      Unfortunately the segment size checks from 72a98a63 had the negative
      side-effect of breaking a corner case in mdsync(): When processing a
      fsync request for a truncated away segment mdsync() could fail with
      "could not fsync file" (if previous segment < RELSEG_SIZE) because
      _mdfd_getseg() now wouldn't return the relevant segment anymore.
      
      The cleanest fix seems to be to allow the caller of _mdfd_getseg() to
      specify whether checks for RELSEG_SIZE are performed. To allow doing so,
      change the ExtensionBehavior enum into a bitmask. Besides allowing for
      the addition of EXTENSION_DONT_CHECK_SIZE, this makes for a nicer
      implementation of EXTENSION_REALLY_RETURN_NULL.
      
      Besides mdsync() the only callsite that should change behaviour due to
      this is mdprefetch() which now doesn't create segments anymore, even in
      recovery. Given the uses of mdprefetch() that seems better.
      
      Reported-By: Thom Brown
      Discussion: CAA-aLv72QazLvPdKZYpVn4a_Eh+i4_cxuB03k+iCuZM_xjc+6Q@mail.gmail.com
      a7124870
    • Peter Eisentraut's avatar
      doc: Fix typos · 613fb29a
      Peter Eisentraut authored
      From: Alexander Law <exclusion@gmail.com>
      613fb29a
  4. 03 May, 2016 3 commits
    • Robert Haas's avatar
      Fix more things to be parallel-safe. · 9888b34f
      Robert Haas authored
      Conversion functions were previously marked as parallel-unsafe, since
      that is the default, but in fact they are safe.  Parallel-safe
      functions defined in pg_proc.h and redefined in system_views.sql were
      ending up as parallel-unsafe because the redeclarations were not
      marked PARALLEL SAFE.  While editing system_views.sql, mark ts_debug()
      parallel safe also.
      
      Andreas Karlsson
      9888b34f
    • Robert Haas's avatar
      Tweak a few more things in preparation for upcoming pgindent run. · 8826d850
      Robert Haas authored
      These adjustments adjust code and comments in minor ways to prevent
      pgindent from mangling them.  Among other things, I tried to avoid
      situations where pgindent would emit "a +b" instead of "a + b", and I
      tried to avoid having it break up inline comments across multiple
      lines.
      8826d850
    • Robert Haas's avatar
      Note that max_worker_processes requires restart. · 1e77949e
      Robert Haas authored
      Since this is a minor issue, no back-patch.
      
      Julien Rouhaud
      1e77949e
  5. 02 May, 2016 8 commits
    • Alvaro Herrera's avatar
      Fix thinko in comment · 6b609168
      Alvaro Herrera authored
      Pointed out by Andres Freund
      6b609168
    • Alvaro Herrera's avatar
      Fix code comments regarding logical decoding · 234a2660
      Alvaro Herrera authored
      Back in 3b02ea4f I added some comments in various places to explain
      how logical decoding and other things worked.  Not all of the changes
      were welcome, because they were misleading or wrong.  This changes them
      a little bit to make them more accurate.
      
      Some other comments are also changed to be more accurate.  Also, fix a
      bunch of typos.
      
      Author: Álvaro Herrera, Craig Ringer
      
      Andres Freund reviewed some parts of this.
      234a2660
    • Tom Lane's avatar
      Docs: improve index entries for new tsvector functions. · 21c2b1c6
      Tom Lane authored
      Fix typos, reword some overly general index entries.
      21c2b1c6
    • Tom Lane's avatar
      Fix configure's incorrect version tests for flex and perl. · 7d7b1292
      Tom Lane authored
      awk's equality-comparison operator is "==" not "=".  We got this right
      in many places, but not in configure's checks for supported version
      numbers of flex and perl.  It hadn't been noticed because unsupported
      versions are so old as to be basically extinct in the wild, and because
      the only consequence is whether or not a WARNING flies by during
      configure.
      
      Daniel Gustafsson noted the problem with respect to the test for flex,
      I found the other by reviewing other awk calls.
      7d7b1292
    • Robert Haas's avatar
      Fix parallel safety markings for pg_start_backup. · 37d0c2cb
      Robert Haas authored
      Commit 71176854 made pg_start_backup
      parallel-restricted rather than parallel-safe, because it now relies
      on backend-private state that won't be synchronized with the parallel
      worker.  However, it didn't update pg_proc.h.  Separately, Andreas
      Karlsson observed that system_views.sql neglected to reiterate the
      parallel-safety markings whe redefining various functions, including
      this one; so add a PARALLEL RESTRICTED declaration there to match
      the new value in pg_proc.h.
      37d0c2cb
    • Robert Haas's avatar
      Again update typedefs.list file in preparation for pgindent run · f2f5e7e7
      Robert Haas authored
      This time, use the buildfarm-supplied contents for this file, instead
      of trying to update it by eyeballing the pgindent output.
      
      Per discussion with Tom and Bruce.
      f2f5e7e7
    • Heikki Linnakangas's avatar
      Remove unused macros. · d22b85fb
      Heikki Linnakangas authored
      CHECK_PAGE_OFFSET_RANGE() has been unused forever.
      CHECK_RELATION_BLOCK_RANGE() has been unused in pgstatindex.c ever since
      bt_page_stats() and bt_page_items() functions were moved from pgstattuple
      to pageinspect module. It still exists in pageinspect/btreefuncs.c.
      
      Daniel Gustafsson
      d22b85fb
    • Peter Eisentraut's avatar
      doc: Fix typo · a956bf43
      Peter Eisentraut authored
      From: Guillaume Lelarge <guillaume@lelarge.info>
      a956bf43
  6. 01 May, 2016 1 commit
    • Tom Lane's avatar
      Add a --non-master-only option to git_changelog. · 8473b7f9
      Tom Lane authored
      This has the inverse effect of --master-only.  It's needed to help find
      cases where a commit should not be described in major release notes
      because it was back-patched into older branches, though not at the same
      time as the HEAD commit.
      8473b7f9
  7. 30 Apr, 2016 5 commits
    • Tom Lane's avatar
      Update contrib/unaccent documentation about its unaccent.rules file. · 6376a16b
      Tom Lane authored
      Commit 1bbd52cb didn't bother with such niceties.
      6376a16b
    • Tom Lane's avatar
      Small improvements to OPTIMIZER_DEBUG code. · 2a2435e6
      Tom Lane authored
      Now that Paths have their own rows field, print that rather than
      the parent relation's rowcount.
      
      Show the relid sets associated with Paths using table names rather
      than numbers; since this code is able to print simple Var references
      using table names, it seems a bit silly that print_relids can't.
      
      Print the cheapest_parameterized_paths list for a RelOptInfo, and
      include information about a parameterized path's required_outer rels.
      
      Noted while trying to use this feature to debug Alexander Kirkouski's
      recent bug report.
      2a2435e6
    • Tom Lane's avatar
      Fix planner crash from pfree'ing a partial path that a GatherPath uses. · c45bf575
      Tom Lane authored
      We mustn't run generate_gather_paths() during add_paths_to_joinrel(),
      because that function can be invoked multiple times for the same target
      joinrel.  Not only is it wasteful to build GatherPaths repeatedly, but
      a later add_partial_path() could delete the partial path that a previously
      created GatherPath depends on.  Instead establish the convention that we
      do generate_gather_paths() for a rel only just before set_cheapest().
      
      The code was accidentally not broken for baserels, because as of today there
      never is more than one partial path for a baserel.  But that assumption
      obviously has a pretty short half-life, so move the generate_gather_paths()
      calls for those cases as well.
      
      Also add some generic comments explaining how and why this all works.
      
      Per fuzz testing by Andreas Seltenreich.
      
      Report: <871t5pgwdt.fsf@credativ.de>
      c45bf575
    • Tom Lane's avatar
      Remove warning about num_sync being too large in synchronous_standby_names. · 17d5db35
      Tom Lane authored
      If we're not going to reject such setups entirely, throwing a WARNING in
      check_synchronous_standby_names() is unhelpful, because it will cause the
      warning to be logged again every time the postmaster receives SIGHUP.
      Per discussion, just remove the warning.
      
      In passing, improve the documentation for synchronous_commit, which had not
      gotten the word that now there can be more than one synchronous standby.
      17d5db35
    • Tom Lane's avatar
      Fix mishandling of equivalence-class tests in parameterized plans. · 207d5a65
      Tom Lane authored
      Given a three-or-more-way equivalence class, such as X.Y = Y.Y = Z.Z,
      it was possible for the planner to omit one of the quals needed to
      enforce that all members of the equivalence class are actually equal.
      This only happened in the case of a parameterized join node for two
      of the relations, that is a plan tree like
      
      	Nested Loop
      	  ->  Scan X
      	  ->  Nested Loop
      	    ->  Scan Y
      	    ->  Scan Z
      	          Filter: Z.Z = X.X
      
      The eclass machinery normally expects to apply X.X = Y.Y when those
      two relations are joined, but in this shape of plan tree they aren't
      joined until the top node --- and, if the lower nested loop is marked
      as parameterized by X, the top node will assume that the relevant eclass
      condition(s) got pushed down into the lower node.  On the other hand,
      the scan of Z assumes that it's only responsible for constraining Z.Z
      to match any one of the other eclass members.  So one or another of
      the required quals sometimes fell between the cracks, depending on
      whether consideration of the eclass in get_joinrel_parampathinfo()
      for the lower nested loop chanced to generate X.X = Y.Y or X.X = Z.Z
      as the appropriate constraint there.  If it generated the latter,
      it'd erroneously suppose that the Z scan would take care of matters.
      To fix, force X.X = Y.Y to be generated and applied at that join node
      when this case occurs.
      
      This is *extremely* hard to hit in practice, because various planner
      behaviors conspire to mask the problem; starting with the fact that the
      planner doesn't really like to generate a parameterized plan of the
      above shape.  (It might have been impossible to hit it before we
      tweaked things to allow this plan shape for star-schema cases.)  Many
      thanks to Alexander Kirkouski for submitting a reproducible test case.
      
      The bug can be demonstrated in all branches back to 9.2 where parameterized
      paths were introduced, so back-patch that far.
      207d5a65
  8. 29 Apr, 2016 7 commits
    • Kevin Grittner's avatar
      Add a few entries to the tail of time mapping, to see old values. · 7c3e8039
      Kevin Grittner authored
      Without a few entries beyond old_snapshot_threshold, the lookup
      would often fail, resulting in the more aggressive pruning or
      vacuum being skipped often enough to matter.  This was very clearly
      shown by a python test script posted by Ants Aasma, and was likely
      a factor in an earlier but somewhat less clear-cut test case posted
      by Jeff Janes.
      
      This patch makes no change to the logic, per se -- it just makes
      the array of mapping entries big enough to make lookup misses based
      on timing much less likely.  An occasional miss is still possible
      if a thread stalls for more than 10 minutes, but that does not
      create any problem with correctness of behavior.  Besides, if
      things are so busy that a thread is stalling for more than 10
      minutes, it is probably OK to skip the more aggressive cleanup at
      that particular point in time.
      7c3e8039
    • Andrew Dunstan's avatar
      Fix comment whitespace in VS2105 patch · d34e7b28
      Andrew Dunstan authored
      per gripe from Michael Paquier.
      d34e7b28
    • Peter Eisentraut's avatar
      doc: Minor wording changes · 82881b2b
      Peter Eisentraut authored
      From: Dmitry Igrishin <dmitigr@gmail.com>
      82881b2b
    • Magnus Hagander's avatar
      Fix typo · a03bda32
      Magnus Hagander authored
      Author: Thomas Munro
      a03bda32
    • Andrew Dunstan's avatar
      Fix typo in VS2015 patch · 7dc54923
      Andrew Dunstan authored
      reported by Christian Ullrich
      7dc54923
    • Andrew Dunstan's avatar
      Support building with Visual Studio 2015 · 0fb54de9
      Andrew Dunstan authored
      Adjust the way we detect the locale. As a result the minumum Windows
      version supported by VS2015 and later is Windows Vista. Add some tweaks
      to remove new compiler warnings. Remove documentation references to the
      now obsolete msysGit.
      
      Michael Paquier, somewhat edited by me, reviewed by Christian Ullrich.
      
      Backpatch to 9.5
      0fb54de9
    • Andres Freund's avatar
      Remember asking for feedback during walsender shutdown. · 59455018
      Andres Freund authored
      Since 5a991ef8 we're explicitly asking for feedback from the receiving
      side when shutting down walsender, if there's not yet replicated
      data.
      
      Unfortunately we didn't remember (i.e. set waiting_for_ping_response to
      true) having asked for feedback, leading to scenarios in which replies
      were requested at a high frequency.
      
      I can't reproduce this problem on my laptop, I think that's because the
      problem requires a significant TCP window to manifest due to the
      !pq_is_send_pending() condition. But since this clearly is a bug, let's
      fix it.  There's quite possibly more wrong than just this though.
      
      While fiddling with WalSndDone(), I rewrote a hard to understand comment
      about looking at the flush vs. the write position.
      
      Reported-By: Nick Cleaton, Magnus Hagander
      Author: Nick Cleaton
      Discussion: CAFgz3kus=rC_avEgBV=+hRK5HYJ8vXskJRh8yEAbahJGTzF2VQ@mail.gmail.com
          CABUevExsjROqDcD0A2rnJ6HK6FuKGyewJr3PL12pw85BHFGS2Q@mail.gmail.com
      Backpatch: 9.4, were 5a991ef8 introduced the use of feedback messages
          during shutdown.
      59455018
  9. 28 Apr, 2016 2 commits
    • Tom Lane's avatar
      Adjust DatumGetBool macro, this time for sure. · 23b09e15
      Tom Lane authored
      Commit 23a41573 attempted to fix the DatumGetBool macro to ignore bits
      in a Datum that are to the left of the actual bool value.  But it did that
      by casting the Datum to bool; and on compilers that use C99 semantics for
      bool, that ends up being a whole-word test, not a 1-byte test.  This seems
      to be the true explanation for contrib/seg failing in VS2015.  To fix, use
      GET_1_BYTE() explicitly.  I think in the previous patch, I'd had some idea
      of not having to commit to bool being exactly 1 byte wide, but regardless
      of what the compiler's bool is, boolean columns and Datums are certainly
      1 byte wide.
      
      The previous fix was (eventually) back-patched into all active versions,
      so do likewise with this one.
      23b09e15
    • Tom Lane's avatar
      Revert "Convert contrib/seg's bool-returning SQL functions to V1 call convention." · f0504230
      Tom Lane authored
      This reverts commit c8e81afc.
      That turns out to have been based on a faulty diagnosis of why the
      VS2015 build was misbehaving.  Instead, we need to fix DatumGetBool().
      f0504230