- Nov 20, 2012
-
-
Tom Lane authored
Some platforms throw an exception for this division, rather than returning a necessarily-overflowed result. Since we were testing for overflow after the fact, an exception isn't nice. We can avoid the problem by treating division by -1 as negation. Add some regression tests so that we'll find out if any compilers try to optimize away the overflow check conditions. Back-patch of commit 1f7cb5c3. Per discussion with Xi Wang, though this is different from the patch he submitted.
-
- Nov 14, 2012
-
-
Tom Lane authored
The correct answer for this (or any other case with arg2 = -1) is zero, but some machines throw a floating-point exception instead of behaving sanely. Commit f9ac414c dealt with this in int4mod, but overlooked the fact that it also happens in int8mod (at least on my Linux x86_64 machine). Protect int2mod as well; it's not clear whether any machines fail there (mine does not) but since the test is so cheap it seems better safe than sorry. While at it, simplify the original guard in int4mod: we need only check for arg2 == -1, we don't need to check arg1 explicitly. Xi Wang, with some editing by me.
-
- Jan 02, 2012
-
-
Bruce Momjian authored
-
- Jun 17, 2011
-
-
Robert Haas authored
The previous code went into an infinite loop after overflow. In fact, an overflow is not really an error; it just means that the current value is the last one we need to return. So, just arrange to stop immediately when overflow is detected. Back-patch all the way.
-
- Mar 12, 2011
-
-
Tom Lane authored
Add dummy returns before every potential division-by-zero in int8.c, because apparently further "improvements" in gcc's optimizer have enabled it to break functions that weren't broken before. Aurelien Jarno, via Martin Pitt
-
- Jan 01, 2011
-
-
Bruce Momjian authored
-
- Nov 20, 2010
-
-
Robert Haas authored
A hand-coded implementation turns out to be much faster than calling printf(). In passing, add a few more regresion tests. Andres Freund, with assorted, mostly cosmetic changes.
-
- Sep 20, 2010
-
-
Magnus Hagander authored
-
- Feb 26, 2010
-
-
Bruce Momjian authored
-
- Feb 08, 2010
-
-
Tom Lane authored
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.
-
- Jan 07, 2010
-
-
Tom Lane authored
we're not going to support that anymore. I did keep the 64-bit-CRC-with-32-bit-arithmetic code, since it has a performance excuse to live. It's a bit moot since that's all ifdef'd out, of course.
-
- Jan 02, 2010
-
-
Bruce Momjian authored
-
- Sep 03, 2009
-
-
Tom Lane authored
to occur for division by zero, even though the code is carefully avoiding that. All available evidence is that the only functions affected are int24div, int48div, and int28div, so patch just those three functions to include a "return" after the ereport() call. Backpatch to 8.4 so that the fix can be tested in production builds. For older branches our recommendation will continue to be to use -O1 on affected platforms (which are mostly non-mainstream anyway).
-
- Jun 11, 2009
-
-
Bruce Momjian authored
provided by Andrew.
-
- Jan 01, 2009
-
-
Bruce Momjian authored
-
- Dec 28, 2008
-
-
Tom Lane authored
Hitoshi Harada, with some kibitzing from Heikki and Tom.
-
- Oct 06, 2008
-
-
Tom Lane authored
machine produces zero (rather than the more usual minimum-possible-integer) for the only possible overflow case. This has been seen to occur for at least some word widths on some hardware, and it's cheap enough to check for everywhere. Per Peter's analysis of buildfarm reports. This could be back-patched, but in the absence of any gripes from the field I doubt it's worth the trouble.
-
- Jun 17, 2008
-
-
Tom Lane authored
int2-and-int8 implementations of the basic arithmetic operators +, -, *, /. This doesn't really add any new functionality, but it avoids "operator is not unique" failures that formerly occurred in these cases because the parser couldn't decide whether to promote the int2 to int4 or int8. We could alternatively have removed the existing cross-type operators, but experimentation shows that the cost of an additional type coercion expression node is noticeable compared to such cheap operators; so let's not give up any performance here. On the other hand, I removed the int2-and-int4 modulo (%) operators since they didn't seem as important from a performance standpoint. Per a complaint last January from ykhuang.
-
- Apr 21, 2008
-
-
Tom Lane authored
where Datum is 8 bytes wide. Since this will break old-style C functions (those still using version 0 calling convention) that have arguments or results of these types, provide a configure option to disable it and retain the old pass-by-reference behavior. Likewise, provide a configure option to disable the recently-committed float4 pass-by-value change. Zoltan Boszormenyi, plus configurability stuff by me.
-
- Jan 01, 2008
-
-
Bruce Momjian authored
-
- Aug 30, 2007
-
-
Tom Lane authored
case, per Florian Pflug. Not back-patched since it's unclear that anyone but me still cares ...
-
- Jun 05, 2007
-
-
Tom Lane authored
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
-
- Feb 28, 2007
-
-
Tom Lane authored
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
-
- Feb 01, 2007
-
-
Bruce Momjian authored
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".
-
- Jan 05, 2007
-
-
Bruce Momjian authored
back-stamped for this.
-
- Oct 04, 2006
-
-
Bruce Momjian authored
-
- Jul 28, 2006
-
-
Tom Lane authored
the float8 versions of the aggregates, which is all that the standard requires. Sergey's original patch also provided versions using numeric arithmetic, but given the size and slowness of the code, I doubt we ought to include those in core.
-
- Mar 05, 2006
-
-
Bruce Momjian authored
-
- Oct 15, 2005
-
-
Bruce Momjian authored
-
- Mar 12, 2005
-
-
Tom Lane authored
can tell whether it is being used as an aggregate or not. This allows such a function to avoid re-pallocing a pass-by-reference transition value; normally it would be unsafe for a function to scribble on an input, but in the aggregate case it's safe to reuse the old transition value. Make int8inc() do this. This gets a useful improvement in the speed of COUNT(*), at least on narrow tables (it seems to be swamped by I/O when the table rows are wide). Per a discussion in early December with Neil Conway. I also fixed int_aggregate.c to check this, thereby turning it into something approaching a supportable technique instead of being a crude hack.
-
- Dec 31, 2004
-
-
PostgreSQL Daemon authored
Tag appropriate files for rc3 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 ...
-
- Oct 04, 2004
-
-
Tom Lane authored
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.
-
- Aug 29, 2004
-
-
Bruce Momjian authored
-
Bruce Momjian authored
-
- Apr 02, 2004
-
-
Tom Lane authored
-
- Mar 11, 2004
-
-
Neil Conway authored
any amount of leading or trailing whitespace (where "whitespace" is defined by isspace()). This is for SQL conformance, as well as consistency with other numeric types (e.g. oid, numeric). Also refactor pg_atoi() to avoid looking at errno where not necessary, and add a bunch of regression tests for the input to these types.
-
- Feb 03, 2004
-
-
Joe Conway authored
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.
-
- Dec 01, 2003
-
-
Bruce Momjian authored
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
-
- Nov 29, 2003
-
-
PostgreSQL Daemon authored
$Header: -> $PostgreSQL Changes ...
-
- Sep 25, 2003
-
-
Peter Eisentraut authored
terms, add some clarifications, fix some untranslatable attempts at dynamic message building.
-