1. 27 Sep, 2019 3 commits
  2. 26 Sep, 2019 6 commits
  3. 25 Sep, 2019 15 commits
  4. 24 Sep, 2019 5 commits
  5. 23 Sep, 2019 5 commits
  6. 22 Sep, 2019 3 commits
    • Tom Lane's avatar
      Fix failure to zero-pad the result of bitshiftright(). · 5ac0d936
      Tom Lane authored
      If the bitstring length is not a multiple of 8, we'd shift the
      rightmost bits into the pad space, which must be zeroes --- bit_cmp,
      for one, depends on that.  This'd lead to the result failing to
      compare equal to what it should compare equal to, as reported in
      bug #16013 from Daryl Waycott.
      
      This is, if memory serves, not the first such bug in the bitstring
      functions.  In hopes of making it the last one, do a bit more work
      than minimally necessary to fix the bug:
      
      * Add assertion checks to bit_out() and varbit_out() to complain if
      they are given incorrectly-padded input.  This will improve the
      odds that manual testing of any new patch finds problems.
      
      * Encapsulate the padding-related logic in macros to make it
      easier to use.
      
      Also, remove unnecessary padding logic from bit_or() and bitxor().
      Somebody had already noted that we need not re-pad the result of
      bit_and() since the inputs are required to be the same length,
      but failed to extrapolate that to the other two.
      
      Also, move a comment block that once was near the head of varbit.c
      (but people kept putting other stuff in front of it), to put it in
      the header block.
      
      Note for the release notes: if anyone has inconsistent data as a
      result of saving the output of bitshiftright() in a table, it's
      possible to fix it with something like
      UPDATE mytab SET bitcol = ~(~bitcol) WHERE bitcol != ~(~bitcol);
      
      This has been broken since day one, so back-patch to all supported
      branches.
      
      Discussion: https://postgr.es/m/16013-c2765b6996aacae9@postgresql.org
      5ac0d936
    • Tom Lane's avatar
      Fix typo in tts_virtual_copyslot. · 0a2f894c
      Tom Lane authored
      The code used the destination slot's natts where it intended to
      use the source slot's natts.  Adding an Assert shows that there
      is no case in "make check-world" where these counts are different,
      so maybe this is a harmless bug, but it's still a bug.
      
      Takayuki Tsunakawa
      
      Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1FD34C0E@G01JPEXMBYT05
      0a2f894c
    • Tom Lane's avatar
      Make some efficiency improvements in LISTEN/NOTIFY. · 51004c71
      Tom Lane authored
      Move the responsibility for advancing the NOTIFY queue tail pointer
      from the listener(s) to the notification sender, and only have the
      sender do it once every few queue pages, rather than after every batch
      of notifications as at present.  This reduces the number of times we
      execute asyncQueueAdvanceTail, and reduces contention when there are
      multiple listeners (since that function requires exclusive lock).
      This change relies on the observation that we don't really need the tail
      pointer to be exactly up-to-date.  It's certainly not necessary to
      attempt to release disk space more often than once per SLRU segment.
      The only other usage of the tail pointer is that an incoming listener,
      if it's the only listener in its database, will need to scan the queue
      forward from the tail; but that's surely a less performance-critical
      path than routine sending and receiving of notifies.  We compromise by
      advancing the tail pointer after every 4 pages of output, so that it
      shouldn't get more than a few pages behind.
      
      Also, when sending signals to other backends after adding notify
      message(s) to the queue, recognize that only backends in our own
      database are going to care about those messages, so only such
      backends really need to be awakened promptly.  Backends in other
      databases should get kicked if they're well behind on reading the
      queue, else they'll hold back the global tail pointer; but wakening
      them for every single message is pointless.  This change can
      substantially reduce signal traffic if listeners are spread among
      many databases.  It won't help for the common case of only a single
      active database, but the extra check costs very little.
      
      Martijn van Oosterhout, with some adjustments by me
      
      Discussion: https://postgr.es/m/CADWG95vtRBFDdrx1JdT1_9nhOFw48KaeTev6F_LtDQAFVpSPhA@mail.gmail.com
      Discussion: https://postgr.es/m/CADWG95uFj8rLM52Er80JnhRsTbb_AqPP1ANHS8XQRGbqLrU+jA@mail.gmail.com
      51004c71
  7. 21 Sep, 2019 3 commits
    • Peter Eisentraut's avatar
      Remove removed file from nls.mk · 72c48c3f
      Peter Eisentraut authored
      part of revert "Add DECLARE STATEMENT support to ECPG."
      72c48c3f
    • Tom Lane's avatar
      Straighten out leakproofness markings on text comparison functions. · c160b892
      Tom Lane authored
      Since we introduced the idea of leakproof functions, texteq and textne
      were marked leakproof but their sibling text comparison functions were
      not.  This inconsistency seemed justified because texteq/textne just
      relied on memcmp() and so could easily be seen to be leakproof, while
      the other comparison functions are far more complex and indeed can
      throw input-dependent errors.
      
      However, that argument crashed and burned with the addition of
      nondeterministic collations, because now texteq/textne may invoke
      the exact same varstr_cmp() infrastructure as the rest.  It makes no
      sense whatever to give them different leakproofness markings.
      
      After a certain amount of angst we've concluded that it's all right
      to consider varstr_cmp() to be leakproof, mostly because the other
      choice would be disastrous for performance of many queries where
      leakproofness matters.  The input-dependent errors should only be
      reachable for corrupt input data, or so we hope anyway; certainly,
      if they are reachable in practice, we've got problems with requirements
      as basic as maintaining a btree index on a text column.
      
      Hence, run around to all the SQL functions that derive from varstr_cmp()
      and mark them leakproof.  This should result in a useful gain in
      flexibility/performance for queries in which non-leakproofness degrades
      the efficiency of the query plan.
      
      Back-patch to v12 where nondeterministic collations were added.
      While this isn't an essential bug fix given the determination
      that varstr_cmp() is leakproof, we might as well apply it now that
      we've been forced into a post-beta4 catversion bump.
      
      Discussion: https://postgr.es/m/31481.1568303470@sss.pgh.pa.us
      c160b892
    • Tom Lane's avatar
      Fix up handling of nondeterministic collations with pattern_ops opclasses. · 28103963
      Tom Lane authored
      text_pattern_ops and its siblings can't be used with nondeterministic
      collations, because they use the text_eq operator which will not behave
      as bitwise equality if applied with a nondeterministic collation.  The
      initial implementation of that restriction was to insert a run-time test
      in the related comparison functions, but that is inefficient, may throw
      misleading errors, and will throw errors in some cases that would work.
      It seems sufficient to just prevent the combination during CREATE INDEX,
      so do that instead.
      
      Lacking any better way to identify the opclasses involved, we need to
      hard-wire tests for them, which requires hand-assigned values for their
      OIDs, which forces a catversion bump because they previously had OIDs
      that would be assigned automatically.  That's slightly annoying in the
      v12 branch, but fortunately we're not at rc1 yet, so just do it.
      
      Back-patch to v12 where nondeterministic collations were added.
      
      In passing, run make reformat-dat-files, which found some unrelated
      whitespace issues (slightly different ones in HEAD and v12).
      
      Peter Eisentraut, with small corrections by me
      
      Discussion: https://postgr.es/m/22566.1568675619@sss.pgh.pa.us
      28103963