1. 21 Feb, 2017 13 commits
    • Tom Lane's avatar
      Fix sloppy handling of corner-case errors in fd.c. · f97de05a
      Tom Lane authored
      Several places in fd.c had badly-thought-through handling of error returns
      from lseek() and close().  The fact that those would seldom fail on valid
      FDs is probably the reason we've not noticed this up to now; but if they
      did fail, we'd get quite confused.
      
      LruDelete and LruInsert actually just Assert'd that lseek never fails,
      which is pretty awful on its face.
      
      In LruDelete, we indeed can't throw an error, because that's likely to get
      called during error abort and so throwing an error would probably just lead
      to an infinite loop.  But by the same token, throwing an error from the
      close() right after that was ill-advised, not to mention that it would've
      left the LRU state corrupted since we'd already unlinked the VFD from the
      list.  I also noticed that really, most of the time, we should know the
      current seek position and it shouldn't be necessary to do an lseek here at
      all.  As patched, if we don't have a seek position and an lseek attempt
      doesn't give us one, we'll close the file but then subsequent re-open
      attempts will fail (except in the somewhat-unlikely case that a
      FileSeek(SEEK_SET) call comes between and allows us to re-establish a known
      target seek position).  This isn't great but it won't result in any state
      corruption.
      
      Meanwhile, having an Assert instead of an honest test in LruInsert is
      really dangerous: if that lseek failed, a subsequent read or write would
      read or write from the start of the file, not where the caller expected,
      leading to data corruption.
      
      In both LruDelete and FileClose, if close() fails, just LOG that and mark
      the VFD closed anyway.  Possibly leaking an FD is preferable to getting
      into an infinite loop or corrupting the VFD list.  Besides, as far as I can
      tell from the POSIX spec, it's unspecified whether or not the file has been
      closed, so treating it as still open could be the wrong thing anyhow.
      
      I also fixed a number of other places that were being sloppy about
      behaving correctly when the seekPos is unknown.
      
      Also, I changed FileSeek to return -1 with EINVAL for the cases where it
      detects a bad offset, rather than throwing a hard elog(ERROR).  It seemed
      pretty inconsistent that some bad-offset cases would get a failure return
      while others got elog(ERROR).  It was missing an offset validity check for
      the SEEK_CUR case on a closed file, too.
      
      Back-patch to all supported branches, since all this code is fundamentally
      identical in all of them.
      
      Discussion: https://postgr.es/m/2982.1487617365@sss.pgh.pa.us
      f97de05a
    • Alvaro Herrera's avatar
      Add tests for two-phase commit · 30820982
      Alvaro Herrera authored
      There's some ongoing performance work on this area, so let's make sure
      we don't break things.
      
      Extracted from a larger patch originally by Stas Kelvich.
      
      Authors: Stas Kelvich, Nikhil Sontakke, Michael Paquier
      Discussion: https://postgr.es/m/CAMGcDxfsuLLOg=h5cTg3g77Jjk-UGnt=RW7zK57zBSoFsapiWA@mail.gmail.com
      30820982
    • Peter Eisentraut's avatar
      Fix whitespace · 74321d87
      Peter Eisentraut authored
      74321d87
    • Fujii Masao's avatar
      Fix typo in comment. · e14ec7d3
      Fujii Masao authored
      neha khatri
      e14ec7d3
    • Fujii Masao's avatar
      Fix connection leak in DROP SUBSCRIPTION command. · 898a792e
      Fujii Masao authored
      Previously the command forgot to close the connection to the publisher
      when it failed to drop the replication slot.
      898a792e
    • Fujii Masao's avatar
      Make walsender always initialize the buffers. · 1d04a59b
      Fujii Masao authored
      Walsender uses the local buffers for each outgoing and incoming message.
      Previously when creating replication slot, walsender forgot to initialize
      one of them and which can cause the segmentation fault error. To fix this
      issue, this commit changes walsender so that it always initialize them
      before it executes the requested replication command.
      
      Back-patch to 9.4 where replication slot was introduced.
      
      Problem report and initial patch by Stas Kelvich, modified by me.
      Report: https://www.postgresql.org/message-id/A1E9CB90-1FAC-4CAD-8DBA-9AA62A6E97C5@postgrespro.ru
      1d04a59b
    • Fujii Masao's avatar
      Remove confusing comment about unsupported feature. · d3653700
      Fujii Masao authored
      The initial table synchronization feature has not been supported yet,
      but there was the confusing header comment about it in logical/worker.c.
      d3653700
    • Peter Eisentraut's avatar
      doc: Update URL for plr · 7248099c
      Peter Eisentraut authored
      7248099c
    • Tom Lane's avatar
      Use less-generic table name in new regression test case. · 1c95f0b4
      Tom Lane authored
      Creating global objects named "foo" isn't an especially wise thing,
      but especially not in a test script that has already used that name
      for something else, and most especially not in a script that runs
      in parallel with other scripts that use that name :-(
      
      Per buildfarm.
      1c95f0b4
    • Peter Eisentraut's avatar
      Make more use of castNode() · 38d10376
      Peter Eisentraut authored
      38d10376
    • Tom Lane's avatar
      Reject too-old Python versions a bit sooner. · 4e5ce3c1
      Tom Lane authored
      Commit 04aad401 added this check after the search for a Python shared
      library, which seems to me to be a pretty unfriendly ordering.  The
      search might fail for what are basically version-related reasons, and
      in such a case it'd be better to say "your Python is too old" than
      "could not find shared library for Python".
      4e5ce3c1
    • Peter Eisentraut's avatar
      Drop support for Python 2.3 · 04aad401
      Peter Eisentraut authored
      There is no specific reason for this right now, but keeping support for
      old Python versions around indefinitely increases the maintenance
      burden.  The oldest supported Python version is now Python 2.4, which is
      still shipped in RHEL/CentOS 5 by default.
      
      In configure, add a check for the required Python version and give a
      friendly error message for an old version, instead of relying on an
      obscure build error later on.
      04aad401
    • Simon Riggs's avatar
      Small correction to BRIN docs · 0bf41dd1
      Simon Riggs authored
      Replace incorrect word "index" with "heap"
      
      Takayuki Tsunakawa
      0bf41dd1
  2. 20 Feb, 2017 2 commits
    • Tom Lane's avatar
      Improve error message for misuse of TZ, tz, OF formatting patterns. · 1c073505
      Tom Lane authored
      Be specific about which pattern is being complained of, and avoid saying
      "it's not supported in to_date", which is just confusing if the error is
      actually coming out of to_timestamp.  We can phrase it as "is only
      supported in to_char", instead.  Also, use the term "formatting field" not
      "format pattern", because other error messages in the same file prefer that
      terminology.  (This isn't terribly consistent with the documentation, so
      maybe we should change all these error messages?)
      1c073505
    • Tom Lane's avatar
      Fix documentation of to_char/to_timestamp TZ, tz, OF formatting patterns. · 10257fc5
      Tom Lane authored
      These are only supported in to_char, not in the other direction, but the
      documentation failed to mention that.  Also, describe TZ/tz as printing the
      time zone "abbreviation", not "name", because what they print is elsewhere
      referred to that way.  Per bug #14558.
      10257fc5
  3. 19 Feb, 2017 7 commits
  4. 18 Feb, 2017 2 commits
  5. 17 Feb, 2017 6 commits
  6. 16 Feb, 2017 3 commits
  7. 15 Feb, 2017 7 commits
    • Tom Lane's avatar
      Formatting and docs corrections for logical decoding output plugins. · 93e6e405
      Tom Lane authored
      Make the typedefs for output plugins consistent with project style;
      they were previously not even consistent with each other as to layout
      or inclusion of parameter names.  Make the documentation look the same,
      and fix errors therein (missing and misdescribed parameters).
      
      Back-patch because of the documentation bugs.
      93e6e405
    • Tom Lane's avatar
      Doc: fix typo in logicaldecoding.sgml. · adb67d67
      Tom Lane authored
      There's no such field as OutputPluginOptions.output_mode;
      it's actually output_type.  Noted by T. Katsumata.
      
      Discussion: https://postgr.es/m/20170215072115.6101.29870@wrigleys.postgresql.org
      adb67d67
    • Tom Lane's avatar
      Make sure that hash join's bulk-tuple-transfer loops are interruptible. · f2ec57de
      Tom Lane authored
      The loops in ExecHashJoinNewBatch(), ExecHashIncreaseNumBatches(), and
      ExecHashRemoveNextSkewBucket() are all capable of iterating over many
      tuples without ever doing a CHECK_FOR_INTERRUPTS, so that the backend
      might fail to respond to SIGINT or SIGTERM for an unreasonably long time.
      Fix that.  In the case of ExecHashJoinNewBatch(), it seems useful to put
      the added CHECK_FOR_INTERRUPTS into ExecHashJoinGetSavedTuple() rather
      than directly in the loop, because that will also ensure that both
      principal code paths through ExecHashJoinOuterGetTuple() will do a
      CHECK_FOR_INTERRUPTS, which seems like a good idea to avoid surprises.
      
      Back-patch to all supported branches.
      
      Tom Lane and Thomas Munro
      
      Discussion: https://postgr.es/m/6044.1487121720@sss.pgh.pa.us
      f2ec57de
    • Tom Lane's avatar
      Doc: fix syntax synopsis for INSERT ... ON CONFLICT DO UPDATE. · 2b187436
      Tom Lane authored
      Commit 906bfcad adjusted the syntax synopsis for UPDATE, but missed
      the fact that the INSERT synopsis now contains a duplicate of that.
      
      In passing, improve wording and markup about using a table alias to
      dodge the conflict with use of "excluded" as a special table name.
      2b187436
    • Tom Lane's avatar
      Fix tab completion for "ALTER SYSTEM SET variable ...". · a5d4e3ff
      Tom Lane authored
      It wouldn't complete "TO" after the variable name, which is certainly
      minor enough.  But since we do complete "TO" after "SET variable ...",
      and since this case used to work pre-9.6, I think this is a bug.
      
      Also, fix the query used to collect the variable names; whoever last
      touched it evidently didn't understand how the pieces are supposed
      to fit together.  It accidentally worked anyway, because readline
      ignores irrelevant completions, but it was randomly unlike the ones
      around it, and could be a source of actual bugs if someone copied
      it as a prototype for another query.
      a5d4e3ff
    • Tom Lane's avatar
      Fix YA unwanted behavioral difference with operator_precedence_warning. · 01e0cbc4
      Tom Lane authored
      Jeff Janes noted that the error cursor position shown for some errors
      would vary when operator_precedence_warning is turned on.  We'd prefer
      that option to have no undocumented effects, so this isn't desirable.
      To fix, make sure that an AEXPR_PAREN node has the same exprLocation
      as its child node.
      
      (Note: it would be a little cheaper to use @2 here instead of an
      exprLocation call, but there are cases where that wouldn't produce
      the identical answer, so don't do it like that.)
      
      Back-patch to 9.5 where this feature was introduced.
      
      Discussion: https://postgr.es/m/CAMkU=1ykK+VhhcQ4Ky8KBo9FoaUJH3f3rDQB8TkTXi-ZsBRUkQ@mail.gmail.com
      01e0cbc4
    • Robert Haas's avatar
      Add optimizer and executor support for parallel index scans. · 5262f7a4
      Robert Haas authored
      In combination with 569174f1, which
      taught the btree AM how to perform parallel index scans, this allows
      parallel index scan plans on btree indexes.  This infrastructure
      should be general enough to support parallel index scans for other
      index AMs as well, if someone updates them to support parallel
      scans.
      
      Amit Kapila, reviewed and tested by Anastasia Lubennikova, Tushar
      Ahuja, and Haribabu Kommi, and me.
      5262f7a4