aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/varlena.c
Commit message (Collapse)AuthorAge
...
* Allow regex operations to be terminated early by query cancel requests.Tom Lane2014-03-01
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Update copyright for 2014Bruce Momjian2014-01-07
| | | | | Update all files in head, and files COPYRIGHT and legal.sgml in all back branches.
* Fix regexp_matches() handling of zero-length matches.Tom Lane2013-07-31
| | | | | | | | | | | 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.
* Move checking an explicit VARIADIC "any" argument into the parser.Andrew Dunstan2013-07-18
| | | | | | | | | 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.
* pgindent run for release 9.3Bruce Momjian2013-05-29
| | | | | This is the first run of the Perl-based pgindent script. Also update pgindent instructions.
* Clean up references to SQL92Peter Eisentraut2013-04-20
| | | | | | 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.
* Extend format() to handle field width and left/right alignment.Tom Lane2013-03-14
| | | | | | This change adds some more standard sprintf() functionality to format(). Pavel Stehule, reviewed by Dean Rasheed and Kyotaro Horiguchi
* Fix concat() and format() to handle VARIADIC-labeled arguments correctly.Tom Lane2013-01-25
| | | | | | | | Previously, the VARIADIC labeling was effectively ignored, but now these functions act as though the array elements had all been given as separate arguments. Pavel Stehule
* Update copyrights for 2013Bruce Momjian2013-01-01
| | | | | Fully update git head, and update back branches in ./COPYRIGHT and legal.sgml files.
* Allow embedded spaces without quoting in unix_socket_directories entries.Tom Lane2012-09-06
| | | | | | | | | | | | | 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.
* Support having multiple Unix-domain sockets per postmaster.Tom Lane2012-08-10
| | | | | | | | | | | | | | 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
* Run pgindent on 9.2 source tree in preparation for first 9.3Bruce Momjian2012-06-10
| | | | commit-fest.
* Fix string truncation to be multibyte-aware in text_name and bpchar_name.Tom Lane2012-05-25
| | | | | | | | | | | Previously, casts to name could generate invalidly-encoded results. Also, make these functions match namein() more exactly, by consistently using palloc0() instead of ad-hoc zeroing code. Back-patch to all supported branches. Karl Schnaitter and Tom Lane
* Rename bytea_agg to string_agg and add delimiter argumentPeter Eisentraut2012-04-13
| | | | | | | | | | 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.
* Update copyright notices for year 2012.Bruce Momjian2012-01-01
|
* Add bytea_agg, parallel to string_agg.Robert Haas2011-12-23
| | | | Pavel Stehule
* Shave a few cycles in string_agg().Robert Haas2011-12-21
| | | | Pavel Stehule
* Miscellaneous cleanup to silence compiler warnings seen on Mingw.Andrew Dunstan2011-12-10
| | | | | Remove some dead code, conditionally declare some items or call some code, and fix one or two declarations.
* Fix concat_ws() to not insert a separator after leading NULL argument(s).Tom Lane2011-08-29
| | | | | Per bug #6181 from Itagaki Takahiro. Also do some marginal code cleanup and improve error handling.
* Use consistent format for reporting GetLastError()Peter Eisentraut2011-08-23
| | | | | | Use something like "error code %lu" for reporting GetLastError() values on Windows. Previously, a mix of different wordings and formats were in use.
* Message style improvementsPeter Eisentraut2011-07-08
|
* Message style tweaksPeter Eisentraut2011-07-05
|
* Pgindent run before 9.1 beta2.Bruce Momjian2011-06-09
|
* Fix integer overflow in text_format function, reported by Dean Rasheed.Heikki Linnakangas2011-05-23
| | | | In the passing, clarify the comment on why text_format_nv wrapper is needed.
* pgindent run before PG 9.1 beta 1.Bruce Momjian2011-04-10
|
* Add collation support on Windows (MSVC build)Peter Eisentraut2011-04-10
| | | | | There is not yet support in initdb to populate the pg_collation catalog, but if that is done manually, the rest should work.
* Improve reporting of run-time-detected indeterminate-collation errors.Tom Lane2011-03-22
| | | | | | | | pg_newlocale_from_collation does not have enough context to give an error message that's even a little bit useful, so move the responsibility for complaining up to its callers. Also, reword ERRCODE_INDETERMINATE_COLLATION error messages in a less jargony, more message-style-guide-compliant fashion.
* Per-column collation supportPeter Eisentraut2011-02-08
| | | | | | | | This adds collation support for columns and domains, a COLLATE clause to override it per expression, and B-tree index support. Peter Eisentraut reviewed by Pavel Stehule, Itagaki Takahiro, Robert Haas, Noah Misch
* Avoid detoast in texteq/textne/byteaeq/byteane for unequal-length strings.Tom Lane2011-01-18
| | | | | | | | | | We can get the length of a compressed or out-of-line datum without actually detoasting it. If the lengths of two strings are unequal, we can then conclude they are unequal without detoasting. That saves considerable work in an admittedly less-common case, without costing anything much when the optimization doesn't apply. Noah Misch
* Stamp copyrights for year 2011.Bruce Momjian2011-01-01
|
* Use memcmp() rather than strncmp() when shorter string length is known.Robert Haas2010-12-21
| | | | | | | It appears that this will be faster for all but the shortest strings; at least one some platforms, memcmp() can use word-at-a-time comparisons. Noah Misch, somewhat pared down.
* Remove useless whitespace at end of linesPeter Eisentraut2010-11-23
|
* Add new SQL function, format(text).Robert Haas2010-11-20
| | | | | | | | | | | Currently, three conversion format specifiers are supported: %s for a string, %L for an SQL literal, and %I for an SQL identifier. The latter two are deliberately designed not to overlap with what sprintf() already supports, in case we want to add more of sprintf()'s functionality here later. Patch by Pavel Stehule, heavily revised by me. Reviewed by Jeff Janes and, in earlier versions, by Itagaki Takahiro and Tom Lane.
* Remove cvs keywords from all files.Magnus Hagander2010-09-20
|
* Add string functions: concat(), concat_ws(), left(), right(), and reverse().Itagaki Takahiro2010-08-24
| | | | Pavel Stehule, reviewed by me.
* Add three-parameter forms of array_to_string and string_to_array, to allowTom Lane2010-08-10
| | | | | | | | | | | | | | | | better handling of NULL elements within the arrays. The third parameter is a string that should be used to represent a NULL element, or should be translated into a NULL element, respectively. If the third parameter is NULL it behaves the same as the two-parameter form. There are two incompatible changes in the behavior of the two-parameter form of string_to_array. First, it will return an empty (zero-element) array rather than NULL when the input string is of zero length. Second, if the field separator is NULL, the function splits the string into individual characters, rather than returning NULL as before. These two changes make this form fully compatible with the behavior of the new three-parameter form. Pavel Stehule, reviewed by Brendan Jurd
* Remove the single-argument form of string_agg(). It added nothing much inTom Lane2010-08-05
| | | | | | | | functionality, while creating an ambiguity in usage with ORDER BY that at least two people have already gotten seriously confused by. Also, add an opr_sanity test to check that we don't in future violate the newly minted policy of not having built-in aggregates with the same name and different numbers of parameters. Per discussion of a complaint from Thom Brown.
* pgindent run for 9.0Bruce Momjian2010-02-26
|
* Create an official API function for C functions to use to check if they areTom Lane2010-02-08
| | | | | | | | | | being called as aggregates, and to get the aggregate transition state memory context if needed. Use it instead of poking directly into AggState and WindowAggState in places that shouldn't know so much. We should have done this in 8.4, probably, but better late than never. Revised version of a patch by Hitoshi Harada.
* Add string_agg aggregate functions. The one argument version concatenatesItagaki Takahiro2010-02-01
| | | | | | | the input values into a string. The two argument version also does the same thing, but inserts delimiters between elements. Original patch by Pavel Stehule, reviewed by David E. Wheeler and me.
* Add get_bit/set_bit functions for bit strings, paralleling those for bytea,Tom Lane2010-01-25
| | | | | | | | | and implement OVERLAY() for bit strings and bytea. In passing also convert text OVERLAY() to a true built-in, instead of relying on a SQL function. Leonardo F, reviewed by Kevin Grittner
* Update copyright for the year 2010.Bruce Momjian2010-01-02
|
* Support hex-string input and output for type BYTEA.Tom Lane2009-08-04
| | | | | | | | | | | | | Both hex format and the traditional "escape" format are automatically handled on input. The output format is selected by the new GUC variable bytea_output. As committed, bytea_output defaults to HEX, which is an *incompatible change*. We will keep it this way for awhile for testing purposes, but should consider whether to switch to the more backwards-compatible default of ESCAPE before 8.5 is released. Peter Eisentraut
* 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef listBruce Momjian2009-06-11
| | | | provided by Andrew.
* varstr_cmp and any comparison function that piggybacks on it can returnHeikki Linnakangas2009-04-23
| | | | | | | any negative or positive number, not just -1 or 1. Fix comment on varstr_cmp and citext test case accordingly. As pointed out by Zdenek Kotala, and buildfarm member gothic moth.
* Update copyright for 2009.Bruce Momjian2009-01-01
|
* Reimplement text_position and related functions to use Boyer-Moore-HorspoolTom Lane2008-09-07
| | | | | | | | searching instead of naive matching. In the worst case this has the same O(M*N) complexity as the naive method, but the worst case is hard to hit, and the average case is very fast, especially with longer patterns. David Rowley
* Alter the xxx_pattern_ops opclasses to use the regular equality operator ofTom Lane2008-05-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | the associated datatype as their equality member. This means that these opclasses can now support plain equality comparisons along with LIKE tests, thus avoiding the need for an extra index in some applications. This optimization was not possible when the pattern opclasses were first introduced, because we didn't insist that text equality meant bitwise equality; but we do now, so there is no semantic difference between regular and pattern equality operators. I removed the name_pattern_ops opclass altogether, since it's really useless: name's regular comparisons are just strcmp() and are unlikely to become something different. Instead teach indxpath.c that btree name_ops can be used for LIKE whether or not the locale is C. This might lead to a useful speedup in LIKE queries on the system catalogs in non-C locales. The ~=~ and ~<>~ operators are gone altogether. (It would have been nice to keep them for backward compatibility's sake, but since the pg_amop structure doesn't allow multiple equality operators per opclass, there's no way.) A not-immediately-obvious incompatibility is that the sort order within bpchar_pattern_ops indexes changes --- it had been identical to plain strcmp, but is now trailing-blank-insensitive. This will impact in-place upgrades, if those ever happen. Per discussions a couple months ago.
* Restructure some header files a bit, in particular heapam.h, by removing someAlvaro Herrera2008-05-12
| | | | | | | | | | | | unnecessary #include lines in it. Also, move some tuple routine prototypes and macros to htup.h, which allows removal of heapam.h inclusion from some .c files. For this to work, a new header file access/sysattr.h needed to be created, initially containing attribute numbers of system columns, for pg_dump usage. While at it, make contrib ltree, intarray and hstore header files more consistent with our header style.
* Clean up a few places where Datums were being treated as pointers withoutTom Lane2008-04-12
| | | | | | | | going through DatumGetPointer or some other "official" conversion macro. Not actually a bug, since Datum the same size as pointer is the only supported case at the moment, but good cleanup for the future. Gavin Sherry