aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/arrayfuncs.c
Commit message (Collapse)AuthorAge
...
* Fix wrong error reports in 'number of array dimensions exceeds theItagaki Takahiro2011-02-01
| | | | | | maximum allowed' messages, that have reported one-less dimensions. Alexey Klyukin
* Fix miscalculation of itemsafter in array_set_slice().Tom Lane2011-01-17
| | | | | | | | | | | If the slice to be assigned to was before the existing array lower bound (requiring at least one null element to spring into existence to fill the gap), the code miscalculated how many entries needed to be copied from the old array's null bitmap. This could result in trashing the array's data area (as seen in bug #5840 from Karsten Loesing), or worse. This has been broken since we first allowed the behavior of assigning to non-adjacent slices, in 8.2. Back-patch to all affected versions.
* Use array_contains_nulls instead of ARR_HASNULL on user-supplied arrays.Tom Lane2011-01-09
| | | | | | | | | | | This applies the fix for bug #5784 to remaining places where we wish to reject nulls in user-supplied arrays. In all these places, there's no reason not to allow a null bitmap to be present, so long as none of the current elements are actually null. I did not change some other places where we are looking at system catalog entries or aggregate transition values, as the presence of a null bitmap in such an array would be suspicious.
* Add array_contains_nulls() function in arrayfuncs.c.Tom Lane2011-01-08
| | | | | | This will support fixing contrib/intarray (and probably other places) so that they don't have to fail on arrays that contain a null bitmap but no live null entries.
* Stamp copyrights for year 2011.Bruce Momjian2011-01-01
|
* Provide hashing support for arrays.Tom Lane2010-10-30
| | | | | | | | | | | | | | | | | | | | | The core of this patch is hash_array() and associated typcache infrastructure, which works just about exactly like the existing support for array comparison. In addition I did some work to ensure that the planner won't think that an array type is hashable unless its element type is hashable, and similarly for sorting. This includes adding a datatype parameter to op_hashjoinable and op_mergejoinable, and adding an explicit "hashable" flag to SortGroupClause. The lack of a cross-check on the element type was a pre-existing bug in mergejoin support --- but it didn't matter so much before, because if you couldn't sort the element type there wasn't any good alternative to failing anyhow. Now that we have the alternative of hashing the array type, there are cases where we can avoid a failure by being picky at the planner stage, so it's time to be picky. The issue of exactly how to combine the per-element hash values to produce an array hash is still open for discussion, but the rest of this is pretty solid, so I'll commit it as-is.
* Remove cvs keywords from all files.Magnus Hagander2010-09-20
|
* Use a non-locale-dependent definition of isspace() in array_in/array_out.Tom Lane2010-08-21
| | | | | | | | | | | | | | | | | | | array_in discards unquoted leading and trailing whitespace in array values, while array_out is careful to quote array elements that contain whitespace. This is problematic when the definition of "whitespace" varies between locales: array_in could drop characters that were meant to be part of the value. To avoid that, lock down "whitespace" to mean only the traditional six ASCII space characters. This change also works around a bug in OS X and some older BSD systems, in which isspace() could return true for character fragments in UTF8 locales. (There may be other places in PG where that bug could cause problems, but this is the only one complained of so far; see recent report from Steven Schlansker.) Back-patch to 9.0, but not further. Given the lack of previous reports of trouble, changing this behavior in stable branches seems to offer more risk of breaking applications than reward of avoiding problems.
* The sanity check added to array_recv() wa a bit too tight; we mustHeikki Linnakangas2010-08-11
| | | | | | | continue to accept an empty array with dimension information. array_send() can output such arrays. Per report from Vladimir Shakhov.
* pgindent run for 9.0Bruce Momjian2010-02-26
|
* Update copyright for the year 2010.Bruce Momjian2010-01-02
|
* binary migration: pg_migratorBruce Momjian2009-12-19
| | | | | Add comments about places where system oids have to be preserved for binary migration.
* Tigthen binary receive functions so that they reject values that the textHeikki Linnakangas2009-09-04
| | | | | | | | | input functions don't accept either. While the backend can handle such values fine, they can cause trouble in clients and in pg_dump/restore. This is followup to the original issue on time datatype reported by Andrew McNamara a while ago. Like that one, none of these seem worth back-patching.
* Revert dubious message wording change.Tom Lane2009-06-22
|
* Message fixesPeter Eisentraut2009-06-21
|
* Fix things so that array_agg_finalfn does not modify or free its inputTom Lane2009-06-20
| | | | | | | ArrayBuildState, per trouble report from Merlin Moncure. By adopting this fix, we are essentially deciding that aggregate final-functions should not modify their inputs ever. Adjust documentation and comments to match that conclusion.
* 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef listBruce Momjian2009-06-11
| | | | provided by Andrew.
* Substitute extraneous underscores with spaces.Alvaro Herrera2009-04-15
|
* Remove SQL-compatibility function cardinality(). It is not exactly clearTom Lane2009-04-09
| | | | | | | how this ought to behave for multi-dimensional arrays. Per discussion, not having it at all seems better than having it with what might prove to be the wrong behavior. We can always add it later when we have consensus on the correct behavior.
* Change cardinality() into a C-code function, instead of a SQL-languageTom Lane2009-04-05
| | | | | | | alias for array_length(v,1). The efficiency gain here is doubtless negligible --- what I'm interested in is making sure that if we have second thoughts about the definition, we will not have to force a post-beta initdb to change the implementation.
* Fix unnest() to handle a toasted input array safely. Per report fromTom Lane2009-01-30
| | | | Alvaro.
* Update copyright for 2009.Bruce Momjian2009-01-01
|
* Support window functions a la SQL:2008.Tom Lane2008-12-28
| | | | Hitoshi Harada, with some kibitzing from Heikki and Tom.
* Implement the basic form of UNNEST, ie unnest(anyarray) returns setofTom Lane2008-11-14
| | | | | | | anyelement. This lacks the WITH ORDINALITY option, as well as the multiple input arrays option added in the most recent SQL specs. But it's still a pretty useful subset of the spec's functionality, and it is enough to allow obsoleting contrib/intagg.
* array_length() function, and for SQL compatibility also cardinality()Peter Eisentraut2008-11-12
| | | | | | | | | | function as a special case. This version still has the suspicious behavior of returning null for an empty array (rather than zero), but this may need a wholesale revision of empty array behavior, currently under discussion. Jim Nasby, Robert Haas, Peter Eisentraut
* ADD array_ndims functionPeter Eisentraut2008-11-04
| | | | Author: Robert Haas <robertmhaas@gmail.com>
* Code review for array_fill patch: fix inadequate check for array size overflowTom Lane2008-07-21
| | | | | | and bogus documentation (dimension arrays are int[] not anyarray). Also the errhint() messages seem to be really errdetail(), since there is nothing heuristic about them. Some other trivial cosmetic improvements.
* Add array_fill() to create arrays initialized with a value.Bruce Momjian2008-07-16
| | | | Pavel Stehule
* 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.
* Add generate_subscripts, a series-generation function which generates anAlvaro Herrera2008-04-28
| | | | | | array's subscripts. Pavel Stehule, some editorialization by me.
* Fix several datatype input functions that were allowing unused bytes in theirTom Lane2008-04-11
| | | | | | | | | | | | | results to contain uninitialized, unpredictable values. While this was okay as far as the datatypes themselves were concerned, it's a problem for the parser because occurrences of the "same" literal might not be recognized as equal by datumIsEqual (and hence not by equal()). It seems sufficient to fix this in the input functions since the only critical use of equal() is in the parser's comparisons of ORDER BY and DISTINCT expressions. Per a trouble report from Marc Cousin. Patch all the way back. Interestingly, array_in did not have the bug before 8.2, which may explain why the issue went unnoticed for so long.
* Simplify and standardize conversions between TEXT datums and ordinary CTom Lane2008-03-25
| | | | | | | | | | | | | | | | | | | | strings. This patch introduces four support functions cstring_to_text, cstring_to_text_with_len, text_to_cstring, and text_to_cstring_buffer, and two macros CStringGetTextDatum and TextDatumGetCString. A number of existing macros that provided variants on these themes were removed. Most of the places that need to make such conversions now require just one function or macro call, in place of the multiple notational layers that used to be needed. There are no longer any direct calls of textout or textin, and we got most of the places that were using handmade conversions via memcpy (there may be a few still lurking, though). This commit doesn't make any serious effort to eliminate transient memory leaks caused by detoasting toasted text objects before they reach text_to_cstring. We changed PG_GETARG_TEXT_P to PG_GETARG_TEXT_PP in a few places where it was easy, but much more could be done. Brendan Jurd and Tom Lane
* Remove long-unused and broken TCL_ARRAYS.Alvaro Herrera2008-02-29
|
* Update copyrights in source tree to 2008.Bruce Momjian2008-01-01
|
* Support varlena fields with single-byte headers and unaligned storage.Tom Lane2007-04-06
| | | | | | | | | This commit breaks any code that assumes that the mere act of forming a tuple (without writing it to disk) does not "toast" any fields. While all available regression tests pass, I'm not totally sure that we've fixed every nook and cranny, especially in contrib. Greg Stark with some help from Tom Lane
* Fix array coercion expressions to ensure that the correct volatility isTom Lane2007-03-27
| | | | | | | | | seen by code inspecting the expression. The best way to do this seems to be to drop the original representation as a function invocation, and instead make a special expression node type that represents applying the element-type coercion function to each array element. In this way the element function is exposed and will be checked for volatility. Per report from Guillaume Smet.
* Replace direct assignments to VARATT_SIZEP(x) with SET_VARSIZE(x, len).Tom Lane2007-02-27
| | | | | | | | | | | Get rid of VARATT_SIZE and VARATT_DATA, which were simply redundant with VARSIZE and VARDATA, and as a consequence almost no code was using the longer names. Rename the length fields of struct varlena and various derived structures to catch anyplace that was accessing them directly; and clean up various places so caught. In itself this patch doesn't change any behavior at all, but it is necessary infrastructure if we hope to play any games with the representation of varlena headers. Greg Stark and Tom Lane
* Update CVS HEAD for 2007 copyright. Back branches are typically notBruce Momjian2007-01-05
| | | | back-stamped for this.
* Tweak accumArrayResult() to double the size of its working arrays whenTom Lane2006-11-08
| | | | | | more space is needed, instead of incrementing by a fixed amount; the old method wastes lots of space and time when the ultimate size is large. Per gripe from Tatsuo.
* Message style improvementsPeter Eisentraut2006-10-06
|
* pgindent run for 8.2.Bruce Momjian2006-10-04
|
* Allow assignment to array elements not contiguous with those alreadyTom Lane2006-09-29
| | | | | | | | | | present; intervening positions are filled with nulls. This behavior is required by SQL99 but was not implementable before 8.2 due to lack of support for nulls in arrays. I have only made it work for the one-dimensional case, which is all that SQL99 requires. It seems quite complex to get it right in higher dimensions, and since we never allowed extension at all in higher dimensions, I think that must count as a future feature addition not a bug fix.
* If we're going to advertise the array overlap/containment operators,Tom Lane2006-09-10
| | | | | | we probably should make them work reliably for all arrays. Fix code to handle NULLs and multidimensional arrays, move it into arrayfuncs.c. GIN is still restricted to indexing arrays with no null elements, however.
* Remove 576 references of include files that were not needed.Bruce Momjian2006-07-14
|
* Sort reference of include files, "A" - "F".Bruce Momjian2006-07-11
|
* Modify all callers of datatype input and receive functions so that if theseTom Lane2006-04-04
| | | | | | | | | | | | | | | functions are not strict, they will be called (passing a NULL first parameter) during any attempt to input a NULL value of their datatype. Currently, all our input functions are strict and so this commit does not change any behavior. However, this will make it possible to build domain input functions that centralize checking of domain constraints, thereby closing numerous holes in our domain support, as per previous discussion. While at it, I took the opportunity to introduce convenience functions InputFunctionCall, OutputFunctionCall, etc to use in code that calls I/O functions. This eliminates a lot of grotty-looking casts, but the main motivation is to make it easier to grep for these places if we ever need to touch them again.
* Update copyright for 2006. Update scripts.Bruce Momjian2006-03-05
|
* Re-run pgindent, fixing a problem where comment lines after a blankBruce Momjian2005-11-22
| | | | | | | | | comment line where output as too long, and update typedefs for /lib directory. Also fix case where identifiers were used as variable names in the backend, but as typedefs in ecpg (favor the backend for indenting). Backpatch to 8.1.X.
* Change array comparison rules to consider dimensionality information,Tom Lane2005-11-19
| | | | | not only the array contents, before claiming two arrays are equal. Per recent discussion.
* Make SQL arrays support null elements. This commit fixes the core arrayTom Lane2005-11-17
| | | | | | | | functionality, but I still need to make another pass looking at places that incidentally use arrays (such as ACL manipulation) to make sure they are null-safe. Contrib needs work too. I have not changed the behaviors that are still under discussion about array comparison and what to do with lower bounds.