1. 25 1月, 2015 1 次提交
    • T
      Replace a bunch more uses of strncpy() with safer coding. · 586dd5d6
      Tom Lane 提交于
      strncpy() has a well-deserved reputation for being unsafe, so make an
      effort to get rid of nearly all occurrences in HEAD.
      
      A large fraction of the remaining uses were passing length less than or
      equal to the known strlen() of the source, in which case no null-padding
      can occur and the behavior is equivalent to memcpy(), though doubtless
      slower and certainly harder to reason about.  So just use memcpy() in
      these cases.
      
      In other cases, use either StrNCpy() or strlcpy() as appropriate (depending
      on whether padding to the full length of the destination buffer seems
      useful).
      
      I left a few strncpy() calls alone in the src/timezone/ code, to keep it
      in sync with upstream (the IANA tzcode distribution).  There are also a
      few such calls in ecpg that could possibly do with more analysis.
      
      AFAICT, none of these changes are more than cosmetic, except for the four
      occurrences in fe-secure-openssl.c, which are in fact buggy: an overlength
      source leads to a non-null-terminated destination buffer and ensuing
      misbehavior.  These don't seem like security issues, first because no stack
      clobber is possible and second because if your values of sslcert etc are
      coming from untrusted sources then you've got problems way worse than this.
      Still, it's undesirable to have unpredictable behavior for overlength
      inputs, so back-patch those four changes to all active branches.
      586dd5d6
  2. 24 1月, 2015 1 次提交
  3. 23 1月, 2015 2 次提交
    • R
      Repair brain fade in commit b181a919. · d060e07f
      Robert Haas 提交于
      The split between which things need to happen in the C-locale case and
      which needed to happen in the locale-aware case was a few bricks short
      of a load.  Try to fix that.
      d060e07f
    • R
      More fixes for abbreviated keys infrastructure. · b181a919
      Robert Haas 提交于
      First, when LC_COLLATE = C, bttext_abbrev_convert should use memcpy()
      rather than strxfrm() to construct the abbreviated key, because the
      authoritative comparator uses memcpy().  If we do anything else here,
      we might get inconsistent answers, and the buildfarm says this risk
      is not theoretical.  It should be faster this way, too.
      
      Second, while I'm looking at bttext_abbrev_convert, convert a needless
      use of goto into the loop it's trying to implement into an actual
      loop.
      
      Both of the above problems date to the original commit of abbreviated
      keys, commit 4ea51cdf.
      
      Third, fix a bogus assignment to tss->locale before tss is set up.
      That's a new goof in commit b529b65d.
      b181a919
  4. 22 1月, 2015 1 次提交
    • R
      Heavily refactor btsortsupport_worker. · b529b65d
      Robert Haas 提交于
      Prior to commit 4ea51cdf, this function
      only had one job, which was to decide whether we could avoid trampolining
      through the fmgr layer when performing sort comparisons.  As of that
      commit, it has a second job, which is to decide whether we can use
      abbreviated keys.  Unfortunately, those two tasks are somewhat intertwined
      in the existing coding, which is likely why neither Peter Geoghegan nor
      I noticed prior to commit that this calls pg_newlocale_from_collation() in
      cases where it didn't previously.  The buildfarm noticed, though.
      
      To fix, rewrite the logic so that the decision as to which comparator to
      use is more cleanly separated from the decision about abbreviation.
      b529b65d
  5. 21 1月, 2015 1 次提交
    • R
      Disable abbreviated keys on Windows. · 1be4eb1b
      Robert Haas 提交于
      Most of the Windows buildfarm members (bowerbird, hamerkop, currawong,
      jacana, brolga) are unhappy with yesterday's abbreviated keys patch,
      although there are some (narwhal, frogmouth) that seem OK with it.
      Since there's no obvious pattern to explain why some are working and
      others are failing, just disable this across-the-board on Windows for
      now.  This is a bit unfortunate since the optimization will be a big
      win in some cases, but we can't leave the buildfarm broken.
      1be4eb1b
  6. 20 1月, 2015 1 次提交
    • R
      Use abbreviated keys for faster sorting of text datums. · 4ea51cdf
      Robert Haas 提交于
      This commit extends the SortSupport infrastructure to allow operator
      classes the option to provide abbreviated representations of Datums;
      in the case of text, we abbreviate by taking the first few characters
      of the strxfrm() blob.  If the abbreviated comparison is insufficent
      to resolve the comparison, we fall back on the normal comparator.
      This can be much faster than the old way of doing sorting if the
      first few bytes of the string are usually sufficient to resolve the
      comparison.
      
      There is the potential for a performance regression if all of the
      strings to be sorted are identical for the first 8+ characters and
      differ only in later positions; therefore, the SortSupport machinery
      now provides an infrastructure to abort the use of abbreviation if
      it appears that abbreviation is producing comparatively few distinct
      keys.  HyperLogLog, a streaming cardinality estimator, is included in
      this commit and used to make that determination for text.
      
      Peter Geoghegan, reviewed by me.
      4ea51cdf
  7. 07 1月, 2015 1 次提交
  8. 14 11月, 2014 1 次提交
  9. 20 9月, 2014 1 次提交
    • R
      Add a fast pre-check for equality of equal-length strings. · e246b3d6
      Robert Haas 提交于
      Testing reveals that that doing a memcmp() before the strcoll() costs
      practically nothing, at least on the systems we tested, and it speeds
      up sorts containing many equal strings significatly.
      
      Peter Geoghegan.  Review by myself and Heikki Linnakangas.  Comments
      rewritten by me.
      e246b3d6
  10. 27 8月, 2014 1 次提交
  11. 15 8月, 2014 1 次提交
    • R
      Add sortsupport routines for text. · b34e37bf
      Robert Haas 提交于
      This provides a small but worthwhile speedup when sorting text, at least
      in cases to which the sortsupport machinery applies.
      
      Robert Haas and Peter Geoghegan
      b34e37bf
  12. 07 5月, 2014 1 次提交
    • B
      pgindent run for 9.4 · 0a783200
      Bruce Momjian 提交于
      This includes removing tabs after periods in C comments, which was
      applied to back branches, so this change should not effect backpatching.
      0a783200
  13. 04 4月, 2014 1 次提交
  14. 02 3月, 2014 1 次提交
    • T
      Allow regex operations to be terminated early by query cancel requests. · 9662143f
      Tom Lane 提交于
      The regex code didn't have any provision for query cancel; which is
      unsurprising given its non-Postgres origin, but still problematic since
      some operations can take a long time.  Introduce a callback function to
      check for a pending query cancel or session termination request, and
      call it in a couple of strategic spots where we can make the regex code
      exit with an error indicator.
      
      If we ever actually split out the regex code as a standalone library,
      some additional work will be needed to let the cancel callback function
      be specified externally to the library.  But that's straightforward
      (certainly so by comparison to putting the locale-dependent character
      classification logic on a similar arms-length basis), and there seems
      no need to do it right now.
      
      A bigger issue is that there may be more places than these two where
      we need to check for cancels.  We can always add more checks later,
      now that the infrastructure is in place.
      
      Since there are known examples of not-terribly-long regexes that can
      lock up a backend for a long time, back-patch to all supported branches.
      I have hopes of fixing the known performance problems later, but adding
      query cancel ability seems like a good idea even if they were all fixed.
      9662143f
  15. 08 1月, 2014 1 次提交
  16. 31 7月, 2013 1 次提交
    • T
      Fix regexp_matches() handling of zero-length matches. · d074b4e5
      Tom Lane 提交于
      We'd find the same match twice if it was of zero length and not immediately
      adjacent to the previous match.  replace_text_regexp() got similar cases
      right, so adjust this search logic to match that.  Note that even though
      the regexp_split_to_xxx() functions share this code, they did not display
      equivalent misbehavior, because the second match would be considered
      degenerate and ignored.
      
      Jeevan Chalke, with some cosmetic changes by me.
      d074b4e5
  17. 18 7月, 2013 1 次提交
    • A
      Move checking an explicit VARIADIC "any" argument into the parser. · d26888bc
      Andrew Dunstan 提交于
      This is more efficient and simpler . It does mean that an untyped NULL
      can no longer be used in such cases, which should be mentioned in
      Release Notes, but doesn't seem a terrible loss. The workaround is to
      cast the NULL to some array type.
      
      Pavel Stehule, reviewed by Jeevan Chalke.
      d26888bc
  18. 30 5月, 2013 1 次提交
  19. 20 4月, 2013 1 次提交
    • P
      Clean up references to SQL92 · cc26ea9f
      Peter Eisentraut 提交于
      In most cases, these were just references to the SQL standard in
      general.  In a few cases, a contrast was made between SQL92 and later
      standards -- those have been kept unchanged.
      cc26ea9f
  20. 15 3月, 2013 1 次提交
  21. 25 1月, 2013 1 次提交
  22. 02 1月, 2013 1 次提交
  23. 06 9月, 2012 1 次提交
    • T
      Allow embedded spaces without quoting in unix_socket_directories entries. · d2286a98
      Tom Lane 提交于
      This fix removes an unnecessary incompatibility with the old behavior of
      the unix_socket_directory parameter.  Since pathnames with embedded spaces
      are fairly popular on some platforms, the incompatibility could be
      significant in practice.  We'll still strip unquoted leading/trailing
      spaces, however.
      
      No docs update since the documentation already implied that it worked
      like this.
      
      Per bug #7514 from Murray Cumming.
      d2286a98
  24. 11 8月, 2012 1 次提交
    • T
      Support having multiple Unix-domain sockets per postmaster. · c9b0cbe9
      Tom Lane 提交于
      Replace unix_socket_directory with unix_socket_directories, which is a list
      of socket directories, and adjust postmaster's code to allow zero or more
      Unix-domain sockets to be created.
      
      This is mostly a straightforward change, but since the Unix sockets ought
      to be created after the TCP/IP sockets for safety reasons (better chance
      of detecting a port number conflict), AddToDataDirLockFile needs to be
      fixed to support out-of-order updates of data directory lockfile lines.
      That's a change that had been foreseen to be necessary someday anyway.
      
      Honza Horak, reviewed and revised by Tom Lane
      c9b0cbe9
  25. 11 6月, 2012 1 次提交
  26. 26 5月, 2012 1 次提交
  27. 14 4月, 2012 1 次提交
    • P
      Rename bytea_agg to string_agg and add delimiter argument · c0cc526e
      Peter Eisentraut 提交于
      Per mailing list discussion, we would like to keep the bytea functions
      parallel to the text functions, so rename bytea_agg to string_agg,
      which already exists for text.
      
      Also, to satisfy the rule that we don't want aggregate functions of
      the same name with a different number of arguments, add a delimiter
      argument, just like string_agg for text already has.
      c0cc526e
  28. 02 1月, 2012 1 次提交
  29. 23 12月, 2011 1 次提交
  30. 21 12月, 2011 1 次提交
  31. 11 12月, 2011 1 次提交
  32. 30 8月, 2011 1 次提交
  33. 24 8月, 2011 1 次提交
  34. 08 7月, 2011 1 次提交
  35. 05 7月, 2011 1 次提交
  36. 10 6月, 2011 1 次提交
  37. 24 5月, 2011 1 次提交
  38. 10 4月, 2011 2 次提交