aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/int.c
Commit message (Collapse)AuthorAge
...
* Update copyrights in source tree to 2008.Bruce Momjian2008-01-01
|
* Downgrade implicit casts to text to be assignment-only, except for the onesTom Lane2007-06-05
| | | | | | | | | | | | | | | | | | | | | | | | | from the other string-category types; this eliminates a lot of surprising interpretations that the parser could formerly make when there was no directly applicable operator. Create a general mechanism that supports casts to and from the standard string types (text,varchar,bpchar) for *every* datatype, by invoking the datatype's I/O functions. These new casts are assignment-only in the to-string direction, explicit-only in the other, and therefore should create no surprising behavior. Remove a bunch of thereby-obsoleted datatype-specific casting functions. The "general mechanism" is a new expression node type CoerceViaIO that can actually convert between *any* two datatypes if their external text representations are compatible. This is more general than needed for the immediate feature, but might be useful in plpgsql or other places in future. This commit does nothing about the issue that applying the concatenation operator || to non-text types will now fail, often with strange error messages due to misinterpreting the operator as array concatenation. Since it often (not always) worked before, we should either make it succeed or at least give a more user-friendly error; but details are still under debate. Peter Eisentraut and Tom Lane
* 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
* Wording cleanup for error messages. Also change can't -> cannot.Bruce Momjian2007-02-01
| | | | | | | | | | | | | | Standard English uses "may", "can", and "might" in different ways: may - permission, "You may borrow my rake." can - ability, "I can lift that log." might - possibility, "It might rain today." Unfortunately, in conversational English, their use is often mixed, as in, "You may use this variable to do X", when in fact, "can" is a better choice. Similarly, "It may crash" is better stated, "It might crash".
* Update CVS HEAD for 2007 copyright. Back branches are typically notBruce Momjian2007-01-05
| | | | back-stamped for this.
* Fix float4/8 to handle Infinity and Nan consistently, e.g. Infinity is aBruce Momjian2007-01-02
| | | | | | | | | | | | | | | | | valid result from a computation if one of the input values was infinity. The previous code assumed an operation that returned infinity was an overflow. Handle underflow/overflow consistently, and add checks for aggregate overflow. Consistently prevent Inf/Nan from being cast to integer data types. Fix INT_MIN % -1 to prevent overflow. Update regression results for new error text. Per report from Roman Kononov.
* pgindent run for 8.2.Bruce Momjian2006-10-04
|
* Avoid use of C commment inside C comment from recent Win32 int overflow patch.Bruce Momjian2006-06-12
|
* Win32 can't catch the exception thrown by INT_MIN / -1 or INT_MIN * -1,Bruce Momjian2006-06-12
| | | | | | | so on that platform we test for those before the computation and throw an "out of range" error. Backpatch to 8.1.X.
* Remove a few places that attempted to define INT_MAX, SCHAR_MAX, andNeil Conway2006-03-11
| | | | | | similar constants if they were not previously defined. All these constants must be defined by limits.h according to C89, so we can safely assume they are present.
* Update copyright for 2006. Update scripts.Bruce Momjian2006-03-05
|
* Repair oidvectorrecv and int2vectorrecv, which I broke while changingTom Lane2006-03-02
| | | | them to use array_recv :-(. Per report from Tim Kordas.
* 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.
* Standard pgindent run for 8.1.Bruce Momjian2005-10-15
|
* Missed adding extra argument to array_recv in a couple of placesTom Lane2005-07-10
| | | | (harmless, actually, but let's be tidy).
* Convert oidvector and int2vector into variable-length arrays. ThisTom Lane2005-03-29
| | | | | | | | | | | | | change saves a great deal of space in pg_proc and its primary index, and it eliminates the former requirement that INDEX_MAX_KEYS and FUNC_MAX_ARGS have the same value. INDEX_MAX_KEYS is still embedded in the on-disk representation (because it affects index tuple header size), but FUNC_MAX_ARGS is not. I believe it would now be possible to increase FUNC_MAX_ARGS at little cost, but haven't experimented yet. There are still a lot of vestigial references to FUNC_MAX_ARGS, which I will clean up in a separate pass. However, getting rid of it altogether would require changing the FunctionCallInfoData struct, and I'm not sure I want to buy into that.
* Add explicit casts between int4 and boolean. Patch from Sean Chittenden,Neil Conway2005-02-27
| | | | editorializing by Neil Conway. Catalog version bumped.
* Tag appropriate files for rc3PostgreSQL Daemon2004-12-31
| | | | | | | | Also performed an initial run through of upgrading our Copyright date to extend to 2005 ... first run here was very simple ... change everything where: grep 1996-2004 && the word 'Copyright' ... scanned through the generated list with 'less' first, and after, to make sure that I only picked up the right entries ...
* Detect overflow in integer arithmetic operators (integer, smallint, andTom Lane2004-10-04
| | | | | | | | bigint variants). Clean up some inconsistencies in error message wording. Fix scanint8 to allow trailing whitespace in INT64_MIN case. Update int8-exp-three-digits.out, which seems to have been ignored by the last couple of people to modify the int8 regression test, and remove int8-exp-three-digits-win32.out which is thereby exposed as redundant.
* Pgindent run for 8.0.Bruce Momjian2004-08-29
|
* Update copyright to 2004.Bruce Momjian2004-08-29
|
* Add function (actually an int4 and an int8 version) that generatesJoe Conway2004-02-03
| | | | | | | | a series of numbers, optionally using an explicit step size other than the default value (one). Use function in the information_schema to replace hard-wired knowledge of INDEX_MAX_KEYS. initdb forced due to pg_proc change. Documentation update still needed -- will be committed separately.
* Attached is a patch implementing factorial(), returning numeric. PointsBruce Momjian2003-12-01
| | | | | | | | | | | | | to note: 1) arttype is numeric. I thought this was the best way of allowing arbitarily large factorials, even though factorial(2^63) is a large number. Happy to change to integers if this is overkill. 2) since we're accepting numeric arguments, the patch tests for floats. If a numeric is passed with non-zero decimal portion, an error is raised since (from memory) they are undefined. Gavin Sherry
* $Header: -> $PostgreSQL Changes ...PostgreSQL Daemon2003-11-29
|
* Update copyrights to 2003.Bruce Momjian2003-08-04
|
* pgindent run.Bruce Momjian2003-08-04
|
* Error message editing in utils/adt. Again thanks to Joe Conway for doingTom Lane2003-07-27
| | | | the bulk of the heavy lifting ...
* Binary send/receive routines for a few basic datatypes --- enough forTom Lane2003-05-09
| | | | testing purposes.
* Add explicit tests for division by zero to all user-accessible integerTom Lane2003-03-11
| | | | | | | | division and modulo functions, to avoid problems on OS X (which fails to trap 0 divide at all) and Windows (which traps it in some bizarre nonstandard fashion). Standardize on 'division by zero' as the one true spelling of this error message. Add regression tests as suggested by Neil Conway.
* Add a bunch of pseudo-types to replace the behavior formerly associatedTom Lane2002-08-22
| | | | | | with OPAQUE, as per recent pghackers discussion. I still want to do some more work on the 'cstring' pseudo-type, but I'm going to commit the bulk of the changes now before the tree starts shifting under me ...
* Update copyright to 2002.Bruce Momjian2002-06-20
|
* Improve readability of factorial, from Florian Weimer.Bruce Momjian2002-06-07
|
* Fix for factorial(0::int2) returning 1, from sugita@sra.co.jp.Bruce Momjian2002-06-07
|
* Make factorial(0) return 1, as per spec.Bruce Momjian2002-02-23
|
* This adds unary plus capability. No grammar changes, per Tom's request.Bruce Momjian2001-06-07
| | | | Marko Kreen
* pgindent run. Make it all clean.Bruce Momjian2001-03-22
|
* Change Copyright from PostgreSQL, Inc to PostgreSQL Global Development Group.Bruce Momjian2001-01-24
|
* Ensure that all uses of <ctype.h> functions are applied to unsigned-charTom Lane2000-12-03
| | | | | values, whether the local char type is signed or not. This is necessary for portability. Per discussion on pghackers around 9/16/00.
* Integer binary operators, from Marko Kreen <marko@l-t.ee>. Renamed bitxorPeter Eisentraut2000-10-24
| | | | operator to '#' for consistency. Parser still needs work.
* Convert all remaining float4 and float8 functions to new fmgr style.Tom Lane2000-08-01
| | | | | | At this point I think it'd be possible to make float4 be pass-by-value without too much work --- and float8 too on machines where Datum is 8 bytes. Something to try when the mood strikes, anyway.
* Revise aggregate functions per earlier discussions in pghackers.Tom Lane2000-07-17
| | | | | | | | | | | There's now only one transition value and transition function. NULL handling in aggregates is a lot cleaner. Also, use Numeric accumulators instead of integer accumulators for sum/avg on integer datatypes --- this avoids overflow at the cost of being a little slower. Implement VARIANCE() and STDDEV() aggregates in the standard backend. Also, enable new LIKE selectivity estimators by default. Unrelated change, but as long as I had to force initdb anyway...
* Remove a bunch of unused configure tests, in particular cases wherePeter Eisentraut2000-07-12
| | | | | | | | | | * the result is not recorded anywhere * the result is not used anywhere * the result is only used in some places, whereas others have been getting away with it * the result is used improperly Also make command line options handling a little better (e.g., --disable-locale, while redundant, should really still *dis*able).
* TOASTJan Wieck2000-07-03
| | | | | | | | WARNING: This is actually broken - we have self-deadlocks due to concurrent changes in buffer management. Vadim and me are working on it. Jan
* Big warnings cleanup for Solaris/GCC. Down to about 40 now, butPeter Eisentraut2000-06-14
| | | | | | | | | | | we'll get there one day. Use `cat' to create aclocal.m4, not `aclocal'. Some people don't have automake installed. Only run the autoconf rule in the top-level GNUmakefile if the invoker specified `make configure', don't run it automatically because of CVS timestamp skew.
* Latest round of fmgr updates. All functions with bool,char, or int2Tom Lane2000-06-05
| | | | | | | inputs have been converted to newstyle. This should go a long way towards fixing our portability problems with platforms where char and short parameters are passed differently from int-width parameters. Still more to do for the Alpha port however.
* Ye-old pgindent run. Same 4-space tabs.Bruce Momjian2000-04-12
|
* Implement column aliases on views "CREATE VIEW name (collist)".Thomas G. Lockhart2000-03-14
| | | | | | | | | | | | | | | | | | Implement TIME WITH TIME ZONE type (timetz internal type). Remap length() for character strings to CHAR_LENGTH() for SQL92 and to remove the ambiguity with geometric length() functions. Keep length() for character strings for backward compatibility. Shrink stored views by removing internal column name list from visible rte. Implement min(), max() for time and timetz data types. Implement conversion of TIME to INTERVAL. Implement abs(), mod(), fac() for the int8 data type. Rename some math functions to generic names: round(), sqrt(), cbrt(), pow(), etc. Rename NUMERIC power() function to pow(). Fix int2 factorial to calculate result in int4. Enhance the Oracle compatibility function translate() to work with string arguments (from Edwin Ramirez). Modify pg_proc system table to remove OID holes.
* Protects you from coredumps if you do eg. str::int4 where str is a textBruce Momjian2000-03-07
| | | | | | | | | field. cf. Tom Lane's <19021.950544016@sss.pgh.pa.us> 14 Feb hackers message. Cheers, Patrick Welche
* Clean up some really grotty coding in catcache.c, improve hashingTom Lane2000-02-21
| | | | performance in catcache lookups.
* Add:Bruce Momjian2000-01-26
| | | | | | * Portions Copyright (c) 1996-2000, PostgreSQL, Inc to all files copyright Regents of Berkeley. Man, that's a lot of files.