1. 28 2月, 2016 1 次提交
  2. 27 2月, 2016 4 次提交
  3. 26 2月, 2016 6 次提交
  4. 25 2月, 2016 3 次提交
    • R
      Enable parallelism for prepared statements and extended query protocol. · 57a6a72b
      Robert Haas 提交于
      Parallel query can't handle running a query only partially rather than
      to completion.  However, there seems to be no way to run a statement
      prepared via SQL PREPARE other than to completion, so we can enable it
      there without a problem.
      
      The situation is more complicated for the extend query protocol.
      libpq seems to provide no way to send an Execute message with a
      non-zero rowcount, but some other client might.  If that happens, and
      a parallel plan was chosen, we'll execute the parallel plan without
      using any workers, which may be somewhat inefficient but should still
      work.  Hopefully this won't be a problem; users can always set
      max_parallel_degree=0 to avoid choosing parallel plans in the first
      place.
      
      Amit Kapila, reviewed by me.
      57a6a72b
    • N
      Clean the last few TAP suite tmp_check directories. · 25924ac4
      Noah Misch 提交于
      Back-patch to 9.5, where the suites were introduced.
      25924ac4
    • N
      MSVC: Clean tmp_check directory of pg_controldata test suite. · 41635887
      Noah Misch 提交于
      Back-patch to 9.4, where the suite was introduced.
      41635887
  5. 23 2月, 2016 2 次提交
    • T
      Create a function to reliably identify which sessions block which others. · 52f5d578
      Tom Lane 提交于
      This patch introduces "pg_blocking_pids(int) returns int[]", which returns
      the PIDs of any sessions that are blocking the session with the given PID.
      Historically people have obtained such information using a self-join on
      the pg_locks view, but it's unreasonably tedious to do it that way with any
      modicum of correctness, and the addition of parallel queries has pretty
      much broken that approach altogether.  (Given some more columns in the view
      than there are today, you could imagine handling parallel-query cases with
      a 4-way join; but ugh.)
      
      The new function has the following behaviors that are painful or impossible
      to get right via pg_locks:
      
      1. Correctly understands which lock modes block which other ones.
      
      2. In soft-block situations (two processes both waiting for conflicting lock
      modes), only the one that's in front in the wait queue is reported to
      block the other.
      
      3. In parallel-query cases, reports all sessions blocking any member of
      the given PID's lock group, and reports a session by naming its leader
      process's PID, which will be the pg_backend_pid() value visible to
      clients.
      
      The motivation for doing this right now is mostly to fix the isolation
      tests.  Commit 38f8bdca lobotomized
      isolationtester's is-it-waiting query by removing its ability to recognize
      nonconflicting lock modes, as a crude workaround for the inability to
      handle soft-block situations properly.  But even without the lock mode
      tests, the old query was excessively slow, particularly in
      CLOBBER_CACHE_ALWAYS builds; some of our buildfarm animals fail the new
      deadlock-hard test because the deadlock timeout elapses before they can
      probe the waiting status of all eight sessions.  Replacing the pg_locks
      self-join with use of pg_blocking_pids() is not only much more correct, but
      a lot faster: I measure it at about 9X faster in a typical dev build with
      Asserts, and 3X faster in CLOBBER_CACHE_ALWAYS builds.  That should provide
      enough headroom for the slower CLOBBER_CACHE_ALWAYS animals to pass the
      test, without having to lengthen deadlock_timeout yet more and thus slow
      down the test for everyone else.
      52f5d578
    • T
      Remove redundant PGPROC.lockGroupLeaderIdentifier field. · 73bf8715
      Tom Lane 提交于
      We don't really need this field, because it's either zero or redundant with
      PGPROC.pid.  The use of zero to mark "not a group leader" is not necessary
      since we can just as well test whether lockGroupLeader is NULL.  This does
      not save very much, either as to code or data, but the simplification seems
      worthwhile anyway.
      73bf8715
  6. 22 2月, 2016 3 次提交
    • A
      Fix wrong keysize in PrivateRefCountHash creation. · ea56b06c
      Andres Freund 提交于
      In 4b4b680c I accidentally used sizeof(PrivateRefCountArray) instead of
      sizeof(PrivateRefCountEntry) when creating the refcount overflow
      hashtable. As the former is bigger than the latter, this luckily only
      resulted in a slightly increased memory usage when many buffers are
      pinned in a backend.
      
      Reported-By: Takashi Horikawa
      Discussion: 73FA3881462C614096F815F75628AFCD035A48C3@BPXM01GP.gisp.nec.co.jp
      Backpatch: 9.5, where thew new ref count infrastructure was introduced
      ea56b06c
    • T
      Docs: make prose discussion match the ordering of Table 9-58. · 64a169d1
      Tom Lane 提交于
      The "Session Information Functions" table seems to be sorted mostly
      alphabetically (although it's not perfect), which would be all right
      if it didn't lead to some related functions being described in a
      pretty nonintuitive order.  Also, the prose discussions after the table
      were in an order that hardly matched the table at all.  Rearrange to
      make things a bit easier to follow.
      64a169d1
    • T
      Cosmetic improvements in new config_info code. · c7a1c5a6
      Tom Lane 提交于
      Coverity griped about use of unchecked strcpy() into a local variable.
      There's unlikely to be any actual bug there, since no caller would be
      passing a path longer than MAXPGPATH, but nonetheless use of strlcpy()
      seems preferable.
      
      While at it, get rid of unmaintainable separation between list of
      field names and list of field values in favor of initializing them
      in parallel.  And we might as well declare get_configdata()'s path
      argument as const char *, even though no current caller needs that.
      c7a1c5a6
  7. 21 2月, 2016 5 次提交
    • A
      Fix two-argument jsonb_object when called with empty arrays · 94c745eb
      Andrew Dunstan 提交于
      Some over-eager copy-and-pasting on my part resulted in a nonsense
      result being returned in this case. I have adopted the same pattern for
      handling this case as is used in the one argument form of the function,
      i.e. we just skip over the code that adds values to the object.
      
      Diagnosis and patch from Michael Paquier, although not quite his
      solution.
      
      Fixes bug #13936.
      
      Backpatch to 9.5 where jsonb_object was introduced.
      94c745eb
    • R
      Fix incorrect decision about which lock to take. · 88aca566
      Robert Haas 提交于
      Spotted by Tom Lane.
      88aca566
    • R
      Cosmetic improvements to group locking. · d91a4a6c
      Robert Haas 提交于
      Reflow text in lock manager README so that it fits within 80 columns.
      Correct some mistakes.  Expand the README to explain not only why group
      locking exists but also the data structures that support it.  Improve
      comments related to group locking several files.  Change the name of a
      macro argument for improved clarity.
      
      Most of these problems were reported by Tom Lane, but I found a few
      of them myself.
      
      Robert Haas and Tom Lane
      d91a4a6c
    • R
      postgres_fdw: Avoid sharing list substructure. · dd077ef8
      Robert Haas 提交于
      list_concat(list_concat(a, b), c) destructively changes both a and b;
      to avoid such perils, copy lists of remote_conds before incorporating
      them into larger lists via list_concat().
      
      Ashutosh Bapat, per a report from Etsuro Fujita
      dd077ef8
    • T
      Fix wording in the Tutorial document. · 902fd1f4
      Tatsuo Ishii 提交于
      With suggentions from Tom Lane.
      902fd1f4
  8. 20 2月, 2016 5 次提交
  9. 19 2月, 2016 5 次提交
    • S
      Correct StartupSUBTRANS for page wraparound · 481725c0
      Simon Riggs 提交于
      StartupSUBTRANS() incorrectly handled cases near the max pageid in the subtrans
      data structure, which in some cases could lead to errors in startup for Hot
      Standby.
      This patch wraps the pageids correctly, avoiding any such errors.
      Identified by exhaustive crash testing by Jeff Janes.
      
      Jeff Janes
      481725c0
    • P
      pg_dump: Fix inconsistent sscanf() conversions · a914a041
      Peter Eisentraut 提交于
      It was using %u to read a string that was earlier produced by snprintf with %d
      into a signed integer variable.  This seems to work in practice but is
      incorrect.
      
      found by cppcheck
      a914a041
    • T
      Add an explicit representation of the output targetlist to Paths. · 19a54114
      Tom Lane 提交于
      Up to now, there's been an assumption that all Paths for a given relation
      compute the same output column set (targetlist).  However, there are good
      reasons to remove that assumption.  For example, an indexscan on an
      expression index might be able to return the value of an expensive function
      "for free".  While we have the ability to generate such a plan today in
      simple cases, we don't have a way to model that it's cheaper than a plan
      that computes the function from scratch, nor a way to create such a plan
      in join cases (where the function computation would normally happen at
      the topmost join node).  Also, we need this so that we can have Paths
      representing post-scan/join steps, where the targetlist may well change
      from one step to the next.  Therefore, invent a "struct PathTarget"
      representing the columns we expect a plan step to emit.  It's convenient
      to include the output tuple width and tlist evaluation cost in this struct,
      and there will likely be additional fields in future.
      
      While Path nodes that actually do have custom outputs will need their own
      PathTargets, it will still be true that most Paths for a given relation
      will compute the same tlist.  To reduce the overhead added by this patch,
      keep a "default PathTarget" in RelOptInfo, and allow Paths that compute
      that column set to just point to their parent RelOptInfo's reltarget.
      (In the patch as committed, actually every Path is like that, since we
      do not yet have any cases of custom PathTargets.)
      
      I took this opportunity to provide some more-honest costing of
      PlaceHolderVar evaluation.  Up to now, the assumption that "scan/join
      reltargetlists have cost zero" was applied not only to Vars, where it's
      reasonable, but also PlaceHolderVars where it isn't.  Now, we add the eval
      cost of a PlaceHolderVar's expression to the first plan level where it can
      be computed, by including it in the PathTarget cost field and adding that
      to the cost estimates for Paths.  This isn't perfect yet but it's much
      better than before, and there is a way forward to improve it more.  This
      costing change affects the join order chosen for a couple of the regression
      tests, changing expected row ordering.
      19a54114
    • B
      pg_upgrade: suppress creation of delete script · 3386f34c
      Bruce Momjian 提交于
      Suppress creation of the pg_upgrade delete script when the new data
      directory is inside the old data directory.
      
      Reported-by: IRC
      
      Backpatch-through: 9.3, where delete script tests were added
      3386f34c
    • T
      Fix multiple bugs in contrib/pgstattuple's pgstatindex() function. · 48e6c943
      Tom Lane 提交于
      Dead or half-dead index leaf pages were incorrectly reported as live, as a
      consequence of a code rearrangement I made (during a moment of severe brain
      fade, evidently) in commit d287818e.
      
      The index metapage was not counted in index_size, causing that result to
      not agree with the actual index size on-disk.
      
      Index root pages were not counted in internal_pages, which is inconsistent
      compared to the case of a root that's also a leaf (one-page index), where
      the root would be counted in leaf_pages.  Aside from that inconsistency,
      this could lead to additional transient discrepancies between the reported
      page counts and index_size, since it's possible for pgstatindex's scan to
      see zero or multiple pages marked as BTP_ROOT, if the root moves due to
      a split during the scan.  With these fixes, index_size will always be
      exactly one page more than the sum of the displayed page counts.
      
      Also, the index_size result was incorrectly documented as being measured in
      pages; it's always been measured in bytes.  (While fixing that, I couldn't
      resist doing some small additional wordsmithing on the pgstattuple docs.)
      
      Including the metapage causes the reported index_size to not be zero for
      an empty index.  To preserve the desired property that the pgstattuple
      regression test results are platform-independent (ie, BLCKSZ configuration
      independent), scale the index_size result in the regression tests.
      
      The documentation issue was reported by Otsuka Kenji, and the inconsistent
      root page counting by Peter Geoghegan; the other problems noted by me.
      Back-patch to all supported branches, because this has been broken for
      a long time.
      48e6c943
  10. 18 2月, 2016 3 次提交
    • P
      Improve error message about active replication slot · 18777c38
      Peter Eisentraut 提交于
      The old phrasing was awkward if a replication slot is activated and
      deactivated repeatedly.
      18777c38
    • J
      Revert inadvertant change in pg_config behavior · fc8a81e3
      Joe Conway 提交于
      In commit a5c43b88 the behavior of command line pg_config was
      inadvertantly changed to include the config name when specific
      configs are requested, similar to when none are requested and
      all are emitted. This breaks scripts that expect to use
      pg_config for e.g. PGXS. Revert the behavior to the previous.
      fc8a81e3
    • J
      Add new system view, pg_config · a5c43b88
      Joe Conway 提交于
      Move and refactor the underlying code for the pg_config client
      application to src/common in support of sharing it with a new
      system information SRF called pg_config() which makes the same
      information available via SQL. Additionally wrap the SRF with a
      new system view, as called pg_config.
      
      Patch by me with extensive input and review by Michael Paquier
      and additional review by Alvaro Herrera.
      a5c43b88
  11. 17 2月, 2016 3 次提交
    • R
      Reuse abbreviated keys in ordered [set] aggregates. · f1f5ec1e
      Robert Haas 提交于
      When processing ordered aggregates following a sort that could make use
      of the abbreviated key optimization, only call the equality operator to
      compare successive pairs of tuples when their abbreviated keys were not
      equal.
      
      Peter Geoghegan, reviewd by Andreas Karlsson and by me.
      f1f5ec1e
    • T
      Make plpython cope with funny characters in function names. · 66f50386
      Tom Lane 提交于
      A function name that's double-quoted in SQL can contain almost any
      characters, but we were using that name directly as part of the name
      generated for the Python-level function, and Python doesn't like
      anything that isn't pretty much a standard identifier.  To fix,
      replace anything that isn't an ASCII letter or digit with an underscore
      in the generated name.  This doesn't create any risk of duplicate Python
      function names because we were already appending the function OID to
      the generated name to ensure uniqueness.  Per bug #13960 from Jim Nasby.
      
      Patch by Jim Nasby, modified a bit by me.  Back-patch to all
      supported branches.
      66f50386
    • T
      Improve documentation about CREATE INDEX CONCURRENTLY. · a65313f2
      Tom Lane 提交于
      Clarify the description of which transactions will block a CREATE INDEX
      CONCURRENTLY command from proceeding, and mention that the index might
      still not be usable after CREATE INDEX completes.  (This happens if the
      index build detected broken HOT chains, so that pg_index.indcheckxmin gets
      set, and there are open old transactions preventing the xmin horizon from
      advancing past the index's initial creation.  I didn't want to explain what
      broken HOT chains are, though, so I omitted an explanation of exactly when
      old transactions prevent the index from being used.)
      
      Per discussion with Chris Travers.  Back-patch to all supported branches,
      since the same text appears in all of them.
      a65313f2