1. 05 Sep, 2015 4 commits
    • Tom Lane's avatar
      Fix CreateTableSpace() so it will compile without HAVE_SYMLINK. · 9270d8db
      Tom Lane authored
      This has been broken since 9.3 (commit 82b1b213 to be exact),
      which suggests that nobody is any longer using a Windows build system that
      doesn't provide a symlink emulation.  Still, it's wrong on its own terms,
      so repair.
      
      YUriy Zhuravlev
      9270d8db
    • Tom Lane's avatar
      Rearrange the handling of error context reports. · 0426f349
      Tom Lane authored
      Remove the code in plpgsql that suppressed the innermost line of CONTEXT
      for messages emitted by RAISE commands.  That was never more than a quick
      backwards-compatibility hack, and it's pretty silly in cases where the
      RAISE is nested in several levels of function.  What's more, it violated
      our design theory that verbosity of error reports should be controlled
      on the client side not the server side.
      
      To alleviate the resulting noise increase, introduce a feature in libpq
      and psql whereby the CONTEXT field of messages can be suppressed, either
      always or only for non-error messages.  Printing CONTEXT for errors only
      is now their default behavior.
      
      The actual code changes here are pretty small, but the effects on the
      regression test outputs are widespread.  I had to edit some of the
      alternative expected outputs by hand; hopefully the buildfarm will soon
      find anything I fat-fingered.
      
      In passing, fix up (again) the output line counts in psql's various
      help displays.  Add some commentary about how to verify them.
      
      Pavel Stehule, reviewed by Petr Jelínek, Jeevan Chalke, and others
      0426f349
    • Heikki Linnakangas's avatar
      Fix misc typos. · c80b5f66
      Heikki Linnakangas authored
      Oskari Saarenmaa. Backpatch to stable branches where applicable.
      c80b5f66
    • Tatsuo Ishii's avatar
      Fix brin index summarizing while vacuuming. · c39f5674
      Tatsuo Ishii authored
      If the number of heap blocks is not multiples of pages per range, the
      summarizing produces wrong summary information for the last brin index
      tuple while vacuuming.
      
      Problem reported by Tatsuo Ishii and fixed by Amit Langote.
      
      Discussion at "[HACKERS] BRIN INDEX value (message id :20150903.174935.1946402199422994347.t-ishii@sraoss.co.jp)
      Backpatched to 9.5 in which brin index was added.
      c39f5674
  2. 04 Sep, 2015 2 commits
    • Tom Lane's avatar
      Fix subtransaction cleanup after an outer-subtransaction portal fails. · c5454f99
      Tom Lane authored
      Formerly, we treated only portals created in the current subtransaction as
      having failed during subtransaction abort.  However, if the error occurred
      while running a portal created in an outer subtransaction (ie, a cursor
      declared before the last savepoint), that has to be considered broken too.
      
      To allow reliable detection of which ones those are, add a bookkeeping
      field to struct Portal that tracks the innermost subtransaction in which
      each portal has actually been executed.  (Without this, we'd end up
      failing portals containing functions that had called the subtransaction,
      thereby breaking plpgsql exception blocks completely.)
      
      In addition, when we fail an outer-subtransaction Portal, transfer its
      resources into the subtransaction's resource owner, so that they're
      released early in cleanup of the subxact.  This fixes a problem reported by
      Jim Nasby in which a function executed in an outer-subtransaction cursor
      could cause an Assert failure or crash by referencing a relation created
      within the inner subtransaction.
      
      The proximate cause of the Assert failure is that AtEOSubXact_RelationCache
      assumed it could blow away a relcache entry without first checking that the
      entry had zero refcount.  That was a bad idea on its own terms, so add such
      a check there, and to the similar coding in AtEOXact_RelationCache.  This
      provides an independent safety measure in case there are still ways to
      provoke the situation despite the Portal-level changes.
      
      This has been broken since subtransactions were invented, so back-patch
      to all supported branches.
      
      Tom Lane and Michael Paquier
      c5454f99
    • Teodor Sigaev's avatar
      Make unaccent handle all diacritics known to Unicode, and expand ligatures correctly · 1bbd52cb
      Teodor Sigaev authored
      Add Python script for buiding unaccent.rules from Unicode data. Don't
      backpatch because unaccent changes may require tsvector/index
      rebuild.
      
      Thomas Munro <thomas.munro@enterprisedb.com>
      1bbd52cb
  3. 03 Sep, 2015 3 commits
    • Robert Haas's avatar
      Assorted code review for recent ProcArrayLock patch. · 4aec4989
      Robert Haas authored
      Post-commit review by Andres Freund discovered a couple of concurrency
      bugs in the original patch: specifically, if the leader cleared a
      follower's XID before it reached PGSemaphoreLock, the semaphore would be
      left in the wrong state; and if another process did PGSemaphoreUnlock
      for some unrelated reason, we might resume execution before the fact
      that our XID was cleared was globally visible.
      
      Also, improve the wording of some comments, rename nextClearXidElem
      to firstClearXidElem in PROC_HDR for clarity, and drop some volatile
      qualifiers that aren't necessary.
      
      Amit Kapila, reviewed and slightly revised by me.
      4aec4989
    • Fujii Masao's avatar
      Document that max_worker_processes must be high enough in standby. · 1ea5ce5c
      Fujii Masao authored
      The setting values of some parameters including max_worker_processes
      must be equal to or higher than the values on the master. However,
      previously max_worker_processes was not listed as such parameter
      in the document. So this commit adds it to that list.
      
      Back-patch to 9.4 where max_worker_processes was added.
      1ea5ce5c
    • Noah Misch's avatar
      Disable fsync throughout TAP test suites. · 7d7a103f
      Noah Misch authored
      Most suites already did so via start_test_server(), but the pg_rewind,
      pg_ctl and pg_controldata suites ran a postmaster or initdb with fsync
      enabled.  This halves the pg_rewind suite's runtime on buildfarm member
      tern.  It makes tern and that machine's other buildfarm members less
      vulnerable to noise failures from postmaster startup overrunning the 60s
      pg_ctl timeout.  Back-patch to 9.5, where pg_rewind was introduced.
      7d7a103f
  4. 02 Sep, 2015 2 commits
    • Robert Haas's avatar
      Update the SSL test suite for recent changes to TAP testing framework. · a09009e4
      Robert Haas authored
      listen_addresses needs to be handled differently now, and so does
      logging.
      
      Michael Paquier
      a09009e4
    • Teodor Sigaev's avatar
      Allow usage of huge maintenance_work_mem for GIN build. · 30bb26b5
      Teodor Sigaev authored
      Currently, in-memory posting list during GIN build process is limited 1GB
      because of using repalloc. The patch replaces call of repalloc to repalloc_huge.
      It increases limit of posting list from 180 millions
      (1GB / sizeof(ItemPointerData)) to 4 billions limited by maxcount/count fields
      in GinEntryAccumulator and subsequent calls. Check added.
      
      Also, fix accounting of allocatedMemory during build to prevent integer
      overflow with maintenance_work_mem > 4GB.
      
      Robert Abraham <robert.abraham86@googlemail.com> with additions by me
      30bb26b5
  5. 01 Sep, 2015 5 commits
  6. 31 Aug, 2015 9 commits
    • Tom Lane's avatar
      Clean up icc + ia64 situation. · 123c9d2f
      Tom Lane authored
      Some googling turned up multiple sources saying that older versions of icc
      do not accept gcc-compatible asm blocks on IA64, though asm does work on
      x86[_64].  This is apparently fixed as of icc version 12.0 or so, but that
      doesn't help us much; if we have to carry the extra implementation anyway,
      we may as well just use it for icc rather than add a compiler version test.
      
      Hence, revert commit 2c713d6e (though I
      separated the icc code from the gcc code completely, producing what seems
      cleaner code).  Document the state of affairs more explicitly, both in
      s_lock.h and postgres.c, and make some cosmetic adjustments around the
      IA64 code in s_lock.h.
      123c9d2f
    • Bruce Momjian's avatar
      docs: remove outdated note about unique indexes · 049a7799
      Bruce Momjian authored
      Patch by Josh Kupershmidt
      
      Backpatch through 9.5
      049a7799
    • Tom Lane's avatar
      Allow icc to use the same atomics infrastructure as gcc. · cf25b2a2
      Tom Lane authored
      The atomics headers were written under the impression that icc doesn't
      handle gcc-style asm blocks, but this is demonstrably false on x86_[64],
      because s_lock.h has done it that way for more than a decade.  (The jury is
      still out on whether this also works on ia64, so I'm leaving ia64-related
      code alone for the moment.)  Treat gcc and icc the same in these headers.
      This is less code and it should improve the results for icc, because we
      hadn't gotten around to providing icc-specific implementations for most
      of the atomics.
      cf25b2a2
    • Tom Lane's avatar
      Actually, it's not that hard to merge the Windows pqsignal code ... · f333204b
      Tom Lane authored
      ... just need to typedef sigset_t and provide sigemptyset/sigfillset,
      which are easy enough.
      f333204b
    • Tom Lane's avatar
      Remove theoretically-unnecessary special case for icc. · 2c713d6e
      Tom Lane authored
      Intel's icc is generally able to swallow asm blocks written for gcc.
      We have a few places that don't seem to know that, though.  Experiment
      with removing the special case for icc in ia64_get_bsp(); if the buildfarm
      likes this, I'll try more cleanup.  This is a good test case because it
      involves a "stop" notation that seems like it might not be very portable.
      2c713d6e
    • Tom Lane's avatar
      Remove support for Unix systems without the POSIX signal APIs. · a65e0864
      Tom Lane authored
      Remove configure's checks for HAVE_POSIX_SIGNALS, HAVE_SIGPROCMASK, and
      HAVE_SIGSETJMP.  These APIs are required by the Single Unix Spec v2
      (POSIX 1997), which we generally consider to define our minimum required
      set of Unix APIs.  Moreover, no buildfarm member has reported not having
      them since 2012 or before, which means that even if the code is still live
      somewhere, it's untested --- and we've made plenty of signal-handling
      changes of late.  So just take these APIs as given and save the cycles for
      configure probes for them.
      
      However, we can't remove as much C code as I'd hoped, because the Windows
      port evidently still uses the non-POSIX code paths for signal masking.
      Since we're largely emulating these BSD-style APIs for Windows anyway, it
      might be a good thing to switch over to POSIX-like notation and thereby
      remove a few more #ifdefs.  But I'm not in a position to code or test that.
      In the meantime, we can at least make things a bit more transparent by
      testing for WIN32 explicitly in these places.
      a65e0864
    • Bruce Momjian's avatar
      psql: print longtable as a possible \pset option · 8f7d044b
      Bruce Momjian authored
      For some reason this message was not updated when the longtable option
      was added.
      
      Backpatch through 9.3
      8f7d044b
    • Magnus Hagander's avatar
      Small grammar fix · 93370076
      Magnus Hagander authored
      Josh Kupershmidt
      93370076
    • Tom Lane's avatar
      Remove long-dead support for platforms without sig_atomic_t. · 0f19d0f1
      Tom Lane authored
      C89 requires <signal.h> to define sig_atomic_t, and there is no evidence
      in the buildfarm that any supported platforms don't comply.  Remove the
      configure test to stop wasting build cycles on a purely historical issue.
      (Once upon a time, we cared about supporting C89-compliant compilers on
      machines with pre-C89 system headers, but that use-case has been dead for
      quite a few years.)
      
      I have some other fixes planned in this area, but let's start with this
      to see if the buildfarm produces any surprising results.
      0f19d0f1
  7. 30 Aug, 2015 1 commit
    • Joe Conway's avatar
      Fix sepgsql regression tests. · 794e2558
      Joe Conway authored
      The regression tests for sepgsql were broken by changes in the
      base distro as-shipped policies. Specifically, definition of
      unconfined_t in the system default policy was changed to bypass
      multi-category rules, which the regression test depended on.
      Fix that by defining a custom privileged domain
      (sepgsql_regtest_superuser_t) and using it instead of system's
      unconfined_t domain. The new sepgsql_regtest_superuser_t domain
      performs almost like the current unconfined_t, but restricted by
      multi-category policy as the traditional unconfined_t was.
      
      The custom policy module is a self defined domain, and so should not
      be affected by related future system policy changes. However, it still
      uses the unconfined_u:unconfined_r pair for selinux-user and role.
      Those definitions have not been changed for several years and seem
      less risky to rely on than the unconfined_t domain. Additionally, if
      we define custom user/role, they would need to be manually defined
      at the operating system level, adding more complexity to an already
      non-standard and complex regression test.
      
      Back-patch to 9.3. The regression tests will need more work before
      working correctly on 9.2. Starting with 9.2, sepgsql has had dependencies
      on libselinux versions that are only available on newer distros with
      the changed set of policies (e.g. RHEL 7.x). On 9.1 sepgsql works
      fine with the older distros with original policy set (e.g. RHEL 6.x),
      and on which the existing regression tests work fine. We might want
      eventually change 9.1 sepgsql regression tests to be more independent
      from the underlying OS policies, however more work will be needed to
      make that happen and it is not clear that it is worth the effort.
      
      Kohei KaiGai with review by Adam Brightwell and me, commentary by
      Stephen, Alvaro, Tom, Robert, and others.
      794e2558
  8. 29 Aug, 2015 1 commit
    • Tom Lane's avatar
      Fix s_lock.h PPC assembly code to be compatible with native AIX assembler. · c41a1215
      Tom Lane authored
      On recent AIX it's necessary to configure gcc to use the native assembler
      (because the GNU assembler hasn't been updated to handle AIX 6+).  This
      caused PG builds to fail with assembler syntax errors, because we'd try
      to compile s_lock.h's gcc asm fragment for PPC, and that assembly code
      relied on GNU-style local labels.  We can't substitute normal labels
      because it would fail in any file containing more than one inlined use of
      tas().  Fortunately, that code is stable enough, and the PPC ISA is simple
      enough, that it doesn't seem like too much of a maintenance burden to just
      hand-code the branch offsets, removing the need for any labels.
      
      Note that the AIX assembler only accepts "$" for the location counter
      pseudo-symbol.  The usual GNU convention is "."; but it appears that all
      versions of gas for PPC also accept "$", so in theory this patch will not
      break any other PPC platforms.
      
      This has been reported by a few people, but Steve Underwood gets the credit
      for being the first to pursue the problem far enough to understand why it
      was failing.  Thanks also to Noah Misch for additional testing.
      c41a1215
  9. 28 Aug, 2015 3 commits
  10. 27 Aug, 2015 1 commit
  11. 26 Aug, 2015 4 commits
    • Tom Lane's avatar
      Speed up HeapTupleSatisfiesMVCC() by replacing the XID-in-progress test. · 8a7d0701
      Tom Lane authored
      Rather than consulting TransactionIdIsInProgress to see if an in-doubt
      transaction is still running, consult XidInMVCCSnapshot.  That requires
      the same or fewer cycles as TransactionIdIsInProgress, and what's far
      more important, it does not access shared data structures (at least in the
      no-subxip-overflow case) so it incurs no contention.  Furthermore, we would
      have had to check XidInMVCCSnapshot anyway before deciding that we were
      allowed to see the tuple.
      
      There should never be a case where XidInMVCCSnapshot says a transaction is
      done while TransactionIdIsInProgress says it's still running.  The other
      way around is quite possible though.  The result of that difference is that
      HeapTupleSatisfiesMVCC will no longer set hint bits on tuples whose source
      transactions recently finished but are still running according to our
      snapshot.  The main cost of delaying the hint-bit setting is that repeated
      visits to a just-committed tuple, by transactions none of which have
      snapshots new enough to see the source transaction as done, will each
      execute TransactionIdIsCurrentTransactionId, which they need not have done
      before.  However, that's normally just a small overhead, and no contention
      costs are involved; so it seems well worth the benefit of removing
      TransactionIdIsInProgress calls during the life of the source transaction.
      
      The core idea for this patch is due to Jeff Janes, who also did the legwork
      proving its performance benefits.  His original proposal was to swap the
      order of TransactionIdIsInProgress and XidInMVCCSnapshot calls in some
      cases within HeapTupleSatisfiesMVCC.  That was a bit messy though.
      The idea that we could dispense with calling TransactionIdIsInProgress
      altogether was mine, as is the final patch.
      8a7d0701
    • Bruce Momjian's avatar
      release notes: abbreviated key speedup only for varchar/text · 16d4f94e
      Bruce Momjian authored
      Report by Peter Geoghegan
      
      Backpatch through 9.5
      16d4f94e
    • Bruce Momjian's avatar
      9.5 release notes: mention lack of char() sort improvements · 8190f2df
      Bruce Momjian authored
      Report by Peter Geoghegan
      
      Backpatch through 9.5
      8190f2df
    • Joe Conway's avatar
      Reestablish alignment of pg_controldata output. · 56c8ce8f
      Joe Conway authored
      Until 9.4, pg_controldata output was all aligned. At some point
      during 9.5 development, a new item was added, namely
      "Current track_commit_timestamp setting:" which is two characters
      too long to be aligned with the rest of the output. Fix this by
      removing the noise word "Current" and adding the requisite number
      of padding spaces. Since the six preceding items are also similar
      in nature, remove "Current" and pad those as well in order to
      maintain overall consistency. Backpatch to 9.5 where new offending
      item was added.
      56c8ce8f
  12. 25 Aug, 2015 4 commits
    • Tom Lane's avatar
      Docs: be explicit about datatype matching for lead/lag functions. · 94324abf
      Tom Lane authored
      The default argument, if given, has to be of exactly the same datatype
      as the first argument; but this was not stated in so many words, and
      the error message you get about it might not lead your thought in the
      right direction.  Per bug #13587 from Robert McGehee.
      
      A quick scan says that these are the only two built-in functions with two
      anyelement arguments and no other polymorphic arguments.  There are plenty
      of cases of, eg, anyarray and anyelement, but those seem less likely to
      confuse.  For instance this doesn't seem terribly hard to figure out:
      "function array_remove(integer[], numeric) does not exist".  So I've
      contented myself with fixing these two cases.
      94324abf
    • Tom Lane's avatar
      Further tweak wording of error messages about bad CONTINUE/EXIT statements. · 781ed2bf
      Tom Lane authored
      Per discussion, a little more verbosity seems called for.
      781ed2bf
    • Tom Lane's avatar
      Limit the verbosity of memory context statistics dumps. · 7b5ef8f2
      Tom Lane authored
      We had a report from Stefan Kaltenbrunner of a case in which postmaster
      log files overran available disk space because multiple backends spewed
      enormous context stats dumps upon hitting an out-of-memory condition.
      Given the lack of similar reports, this isn't a common problem, but it
      still seems worth doing something about.  However, we don't want to just
      blindly truncate the output, because that might prevent diagnosis of OOM
      problems.  What seems like a workable compromise is to limit the dump to
      100 child contexts per parent, and summarize the space used within any
      additional child contexts.  That should help because practical cases where
      the dump gets long will typically be huge numbers of siblings under the
      same parent context; while the additional debugging value from seeing
      details about individual siblings beyond 100 will not be large, we hope.
      Anyway it doesn't take much code or memory space to do this, so let's try
      it like this and see how things go.
      
      Since the summarization mechanism requires passing totals back up anyway,
      I took the opportunity to add a "grand total" line to the end of the
      printout.
      7b5ef8f2
    • Tom Lane's avatar
      Fix potential platform dependence in gist regression test. · e39c4afc
      Tom Lane authored
      The results of the KNN-search test cases were indeterminate, as they asked
      the system to sort pairs of points that are exactly equidistant from the
      query reference point.  It's a bit surprising that we've seen no
      platform-specific failures from this in the buildfarm.  Perhaps IEEE-float
      math is well enough standardized that no such failures will ever occur on
      supported platforms ... but since this entire regression test has yet to be
      shipped in any non-alpha release, that seems like an unduly optimistic
      assumption.  Tweak the queries so that the correct output is uniquely
      defined.
      
      (The other queries in this test are also underdetermined; but it looks like
      they are regurgitating index rows in insertion order, so for the moment
      assume that that behavior is stable enough.)
      
      Per Greg Stark's experiments with VAX.  Back-patch to 9.5 where this test
      script was introduced.
      e39c4afc
  13. 23 Aug, 2015 1 commit