1. 12 Apr, 2017 1 commit
    • Magnus Hagander's avatar
      Fix reversed check of return value from sync · b935eb7d
      Magnus Hagander authored
      While at it also update the comments in walmethods.h to make it less
      likely for mistakes like this to appear in the future (thanks to Tom for
      improvements to the comments).
      
      And finally, in passing change the return type of walmethod.getlasterror
      to being const, also per suggestion from Tom.
      b935eb7d
  2. 11 Apr, 2017 15 commits
    • Tom Lane's avatar
      Remove bogus redefinition of _MSC_VER. · 587d62d8
      Tom Lane authored
      Commit a4777f35 was a shade too mechanical: we don't want to override
      MSVC's own definition of _MSC_VER, as that breaks tests on its numerical
      value.  Per buildfarm.
      587d62d8
    • Tom Lane's avatar
      Simplify handling of remote-qual pass-forward in postgres_fdw. · 88e902b7
      Tom Lane authored
      Commit 0bf3ae88 encountered a need to pass the finally chosen remote qual
      conditions forward from postgresGetForeignPlan to postgresPlanDirectModify.
      It solved that by sticking them into the plan node's fdw_private list,
      which in hindsight was a pretty bad idea.  In the first place, there's no
      use for those qual trees either in EXPLAIN or execution; indeed they could
      never safely be used for any post-planning purposes, because they would not
      get processed by setrefs.c.  So they're just dead weight to carry around in
      the finished plan tree, plus being an attractive nuisance for somebody who
      might get the idea that they could be used that way.  Secondly, because
      those qual trees (sometimes) contained RestrictInfos, they created a
      plan-transmission hazard for parallel query, which is how come we noticed a
      problem.  We dealt with that symptom in commit 28b04787, but really a more
      straightforward and more efficient fix is to pass the data through in a new
      field of struct PgFdwRelationInfo.  So do it that way.  (There's no need
      to revert 28b04787, as it has sufficient reason to live anyway.)
      
      Per fuzz testing by Andreas Seltenreich.
      
      Discussion: https://postgr.es/m/87tw5x4vcu.fsf@credativ.de
      88e902b7
    • Robert Haas's avatar
      Allow a rule on partitioned table to be renamed. · 02af7857
      Robert Haas authored
      Commit f0e44751 should have updated
      this code, but did not.
      
      Amit Langote
      
      Discussion: http://postgr.es/m/52d9c443-ec78-5c8a-7a77-0f34aad12b82@lab.ntt.co.jp
      02af7857
    • Robert Haas's avatar
      Add an Assert() to max_parallel_workers enforcement. · 6599c9ac
      Robert Haas authored
      To prevent future bugs along the lines of the one corrected by commit
      8ff51869, or find any that remain
      in the current code, add an Assert() that the difference between
      parallel_register_count and parallel_terminate_count is in a sane
      range.
      
      Kuntal Ghosh, with considerable tidying-up by me, per a suggestion
      from Neha Khatri.  Reviewed by Tomas Vondra.
      
      Discussion: http://postgr.es/m/CAFO0U+-E8yzchwVnvn5BeRDPgX2z9vZUxQ8dxx9c0XFGBC7N1Q@mail.gmail.com
      6599c9ac
    • Robert Haas's avatar
      Fix confusion of max_parallel_workers mechanism following crash. · 8ff51869
      Robert Haas authored
      Commit b460f5d6 failed to contemplate
      the possibilit that a parallel worker registered before a crash would
      be unregistered only after the crash; if that happened, we'd end up
      with parallel_terminate_count > parallel_register_count and the
      system would refuse to launch any more parallel workers.
      
      The easiest way to fix that seems to be to forget BGW_NEVER_RESTART
      workers in ResetBackgroundWorkerCrashTimes() rather than leaving them
      around to be cleaned up after the conclusion of the restart, so that
      they go away before rather than after shared memory is reset.
      
      To make sure that this fix is water-tight, don't allow parallel
      workers to be anything other than BGW_NEVER_RESTART, so that after
      recovering from a crash, 0 is guaranteed to be the correct starting
      value for parallel_register_count.  The core code wouldn't do this
      anyway, but somebody might try to do it in extension code.
      
      Report by Thomas Vondra.  Patch by me, reviewed by Kuntal Ghosh.
      
      Discussion: http://postgr.es/m/CAGz5QC+AVEVS+3rBKRq83AxkJLMZ1peMt4nnrQwczxOrmo3CNw@mail.gmail.com
      8ff51869
    • Bruce Momjian's avatar
      doc: clearify pg_upgrade default copy behavior · 1e298b8d
      Bruce Momjian authored
      Reported-by: default avatarMarek <marek.cvoren@gmail.com>
      
      Discussion: 20170328110253.2695.62609@wrigleys.postgresql.org
      1e298b8d
    • Robert Haas's avatar
      Fix failure when a shared tidbitmap has only one page. · 4c3b59ab
      Robert Haas authored
      Commit 98e6e890 made inadequate
      provision for the case of a single-page shared tidbitmap.  It
      allocate space for a shared PagetableEntry, but failed to
      initialize it.
      
      Report by Thomas Munro.  Patch by Dilip Kumar, with some comment
      changes by me.
      
      Discussion: http://postgr.es/m/CAEepm=19Cmnfbi-j2Bw-a6yGPeHE1OVhKvvKz9bRBTJGKfGHMA@mail.gmail.com
      4c3b59ab
    • Tom Lane's avatar
      Handle restriction clause lists more uniformly in postgres_fdw. · 28b04787
      Tom Lane authored
      Clauses in the lists retained by postgres_fdw during planning were
      sometimes bare boolean clauses, sometimes RestrictInfos, and sometimes
      a mixture of the two in the same list.  The comment about that situation
      didn't come close to telling the full truth, either.  Aside from being
      confusing, this had a couple of bad practical consequences:
      * waste of planning cycles due to inability to cache per-clause selectivity
      and cost estimates;
      * sometimes, RestrictInfos would sneak into the fdw_private list of a
      finished Plan node, causing failures if, for example, we tried to ship
      the Plan tree to a parallel worker.
      (It may well be that it's a bug in the parallel-query logic that we
      would ever try to ship such a plan to a parallel worker, but in any
      case this deserves to be cleaned up.)
      
      To fix, rearrange so that clause lists in PgFdwRelationInfo are always
      lists of RestrictInfos, and then strip the RestrictInfos at the last
      minute when making a Plan node.  In passing do a bit of refactoring and
      comment cleanup in postgresGetForeignPlan and foreign_join_ok.
      
      Although the messiness here dates back at least to 9.6, there's no evidence
      that it causes anything worse than wasted planning cycles in 9.6, so no
      back-patch for now.
      
      Per fuzz testing by Andreas Seltenreich.
      
      Tom Lane and Ashutosh Bapat
      
      Discussion: https://postgr.es/m/87tw5x4vcu.fsf@credativ.de
      28b04787
    • Fujii Masao's avatar
      Add max_sync_workers_per_subscription to postgresql.conf.sample. · ff7bce17
      Fujii Masao authored
      This commit also does
      
      - add REPLICATION_SUBSCRIBERS into config_group
      - mark max_logical_replication_workers and max_sync_workers_per_subscription
        as REPLICATION_SUBSCRIBERS parameters
      - move those parameters into "Subscribers" section in postgresql.conf.sample
      
      Author: Masahiko Sawada, Petr Jelinek and me
      Reported-by: Masahiko Sawada
      Discussion: http://postgr.es/m/CAD21AoAonSCoa=v=87ZO3vhfUZA1k_E2XRNHTt=xioWGUa+0ug@mail.gmail.com
      ff7bce17
    • Bruce Momjian's avatar
      docs: Improve window function docs · 1c1a4726
      Bruce Momjian authored
      Specifically, the behavior of general-purpose and statistical aggregates
      as window functions was not clearly documented, and terms were
      inconsistently used.  Also add docs about the difference between
      cume_dist and percent_rank, rather than just the formulas.
      
      Discussion: 20170406214918.GA5757@momjian.us
      1c1a4726
    • Magnus Hagander's avatar
      Remove symbol WIN32_ONLY_COMPILER · a4777f35
      Magnus Hagander authored
      This used to mean "Visual C++ except in those parts where Borland C++
      was supported where it meant one of those". Now that we don't support
      Borland C++ anymore, simplify by using _MSC_VER which is the normal way
      to detect Visual C++.
      a4777f35
    • Magnus Hagander's avatar
      Remove support for bcc and msvc standalone libpq builds · 6da56f3f
      Magnus Hagander authored
      This removes the support for building just libpq using Borland C++ or
      Visual C++. This has not worked properly for years, and given the number
      of complaints it's clearly not worth the maintenance burden.
      
      Building libpq using the standard MSVC build system is of course still
      supported, along with mingw.
      6da56f3f
    • Robert Haas's avatar
      Fix possibile deadlock when dropping partitions. · 258cef12
      Robert Haas authored
      heap_drop_with_catalog and RangeVarCallbackForDropRelation should
      lock the parent before locking the target relation.
      
      Amit Langote
      
      Discussion: http://postgr.es/m/29588799-a8ce-b0a2-3dae-f39ff6d35922@lab.ntt.co.jp
      258cef12
    • Tom Lane's avatar
      Fix pgbench's --progress-timestamp option to print Unix-epoch timestamps. · feffa0e0
      Tom Lane authored
      As a consequence of commit 1d63f7d2, on platforms with CLOCK_MONOTONIC,
      you got some random timescale or other instead of standard Unix timestamps
      as expected.  I'd attempted to fix pgbench for that change in commits
      74baa1e3 and 67a87535, but missed this place.  Fix in the same way as
      those previous commits, ie, just eat the cost of an extra gettimeofday();
      one extra syscall per progress report isn't worth sweating over.  Per
      report from Jeff Janes.
      
      In passing, use snprintf not sprintf for this purpose.  I don't think
      there's any chance of actual buffer overrun, but it just looks safer.
      
      Discussion: https://postgr.es/m/CAMkU=1zrQaPwBN+NcBd3pWCb=vWaiL=mmWfJjDJjh-a7eVr-Og@mail.gmail.com
      feffa0e0
    • Michael Meskes's avatar
      Document that bytea is best represented as char * in C for ecpg. · a6940bdc
      Michael Meskes authored
      Patch by Kato, Sho <kato-sho@jp.fujitsu.com>
      a6940bdc
  3. 10 Apr, 2017 11 commits
  4. 09 Apr, 2017 2 commits
  5. 08 Apr, 2017 7 commits
    • Tom Lane's avatar
      Clean up bugs in clause_selectivity() cleanup. · eef8c006
      Tom Lane authored
      Commit ac2b0950 was not terribly carefully reviewed.  Band-aid it to
      not fail on non-RestrictInfo input, per report from Andreas Seltenreich.
      Also make it do something more reasonable with variable-free clauses,
      and improve nearby comments.
      
      Discussion: https://postgr.es/m/87inmf5rdx.fsf@credativ.de
      eef8c006
    • Tom Lane's avatar
      Add newly-symlinked files to "make clean" target. · aba696d1
      Tom Lane authored
      Oversight in 60f11b87.
      aba696d1
    • Heikki Linnakangas's avatar
      Fix the new SASLprep tests to work with non-UTF-8 locales. · 9025af3e
      Heikki Linnakangas authored
      Fix by forcing database encoding to UTF-8, regardless of the current
      locale.
      
      Pointed out by Tom Lane.
      
      Discussion: https://www.postgresql.org/message-id/8934.1491614631@sss.pgh.pa.us
      9025af3e
    • Peter Eisentraut's avatar
      doc: Add some markup · f0e44021
      Peter Eisentraut authored
      f0e44021
    • Kevin Grittner's avatar
      Add GUCs for predicate lock promotion thresholds. · c63172d6
      Kevin Grittner authored
      Defaults match the fixed behavior of prior releases, but now DBAs
      have better options to tune serializable workloads.
      
      It might be nice to be able to set this per relation, but that part
      will need to wait for another release.
      
      Author: Dagfinn Ilmari Mannsåker
      c63172d6
    • Tom Lane's avatar
      Optimize joins when the inner relation can be proven unique. · 9c7f5229
      Tom Lane authored
      If there can certainly be no more than one matching inner row for a given
      outer row, then the executor can move on to the next outer row as soon as
      it's found one match; there's no need to continue scanning the inner
      relation for this outer row.  This saves useless scanning in nestloop
      and hash joins.  In merge joins, it offers the opportunity to skip
      mark/restore processing, because we know we have not advanced past the
      first possible match for the next outer row.
      
      Of course, the devil is in the details: the proof of uniqueness must
      depend only on joinquals (not otherquals), and if we want to skip
      mergejoin mark/restore then it must depend only on merge clauses.
      To avoid adding more planning overhead than absolutely necessary,
      the present patch errs in the conservative direction: there are cases
      where inner_unique or skip_mark_restore processing could be used, but
      it will not do so because it's not sure that the uniqueness proof
      depended only on "safe" clauses.  This could be improved later.
      
      David Rowley, reviewed and rather heavily editorialized on by me
      
      Discussion: https://postgr.es/m/CAApHDvqF6Sw-TK98bW48TdtFJ+3a7D2mFyZ7++=D-RyPsL76gw@mail.gmail.com
      9c7f5229
    • Andres Freund's avatar
      Fix issues in e8fdbd58. · f13a9121
      Andres Freund authored
      When the 64bit atomics simulation is in use, we can't necessarily
      guarantee the correct alignment of the atomics due to lack of compiler
      support for doing so- that's fine from a safety perspective, because
      everything is protected by a lock, but we asserted the alignment in
      all cases.  Weaken them.  Per complaint from Alvaro Herrera.
      
      My #ifdefery for PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY wasn't
      sufficient. Fix that.  Per complaint from Alexander Korotkov.
      f13a9121
  6. 07 Apr, 2017 4 commits