summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/numutils.c
AgeCommit message (Collapse)Author
2017-06-21Phase 3 of pgindent updates.Tom Lane
Don't move parenthesized lines to the left, even if that means they flow past the right margin. By default, BSD indent lines up statement continuation lines that are within parentheses so that they start just to the right of the preceding left parenthesis. However, traditionally, if that resulted in the continuation line extending to the right of the desired right margin, then indent would push it left just far enough to not overrun the margin, if it could do so without making the continuation line start to the left of the current statement indent. That makes for a weird mix of indentations unless one has been completely rigid about never violating the 80-column limit. This behavior has been pretty universally panned by Postgres developers. Hence, disable it with indent's new -lpl switch, so that parenthesized lines are always lined up with the preceding left paren. This patch is much less interesting than the first round of indent changes, but also bulkier, so I thought it best to separate the effects. Discussion: https://postgr.es/m/[email protected] Discussion: https://postgr.es/m/[email protected]
2017-01-18Make messages mentioning type names more uniformAlvaro Herrera
This avoids additional translatable strings for each distinct type, as well as making our quoting style around type names more consistent (namely, that we don't quote type names). This continues what started as f402b9950120. Discussion: https://postgr.es/m/[email protected]
2017-01-03Update copyright via script for 2017Bruce Momjian
2016-04-13Use PG_INT32_MIN instead of reiterating the constant.Robert Haas
Makes no difference, but it's cleaner this way. Michael Paquier
2016-03-13Fix Windows portability issue in 23a27b039d94ba35.Tom Lane
_strtoui64() is available in MSVC builds, but apparently not with other Windows toolchains. Thanks to Petr Jelinek for the diagnosis.
2016-03-12Widen query numbers-of-tuples-processed counters to uint64.Tom Lane
This patch widens SPI_processed, EState's es_processed field, PortalData's portalPos field, FuncCallContext's call_cntr and max_calls fields, ExecutorRun's count argument, PortalRunFetch's result, and the max number of rows in a SPITupleTable to uint64, and deals with (I hope) all the ensuing fallout. Some of these values were declared uint32 before, and others "long". I also removed PortalData's posOverflow field, since that logic seems pretty useless given that portalPos is now always 64 bits. The user-visible results are that command tags for SELECT etc will correctly report tuple counts larger than 4G, as will plpgsql's GET GET DIAGNOSTICS ... ROW_COUNT command. Queries processing more tuples than that are still not exactly the norm, but they're becoming more common. Most values associated with FETCH/MOVE distances, such as PortalRun's count argument and the count argument of most SPI functions that have one, remain declared as "long". It's not clear whether it would be worth promoting those to int64; but it would definitely be a large dollop of additional API churn on top of this, and it would only help 32-bit platforms which seem relatively less likely to see any benefit. Andreas Scherbaum, reviewed by Christian Ullrich, additional hacking by me
2016-02-07Improve speed of timestamp/time/date output functions.Tom Lane
It seems that sprintf(), at least in glibc's version, is unreasonably slow compared to hand-rolled code for printing integers. Replacing most uses of sprintf() in the datetime.c output functions with special-purpose code turns out to give more than a 2X speedup in COPY of a table with a single timestamp column; which is pretty impressive considering all the other logic in that code path. David Rowley and Andres Freund, reviewed by Peter Geoghegan and myself
2016-01-02Update copyright for 2016Bruce Momjian
Backpatch certain files through 9.1
2015-04-02Define integer limits independently from the system definitions.Andres Freund
In 83ff1618 we defined integer limits iff they're not provided by the system. That turns out not to be the greatest idea because there's different ways some datatypes can be represented. E.g. on OSX PG's 64bit datatype will be a 'long int', but OSX unconditionally uses 'long long'. That disparity then can lead to warnings, e.g. around printf formats. One way to fix that would be to back int64 using stdint.h's int64_t. While a good idea it's not that easy to implement. We would e.g. need to include stdint.h in our external headers, which we don't today. Also computing the correct int64 printf formats in that case is nontrivial. Instead simply prefix the integer limits with PG_ and define them unconditionally. I've adjusted all the references to them in code, but not the ones in comments; the latter seems unnecessary to me. Discussion: [email protected]
2015-03-25Centralize definition of integer limits.Andres Freund
Several submitted and even committed patches have run into the problem that C89, our baseline, does not provide minimum/maximum values for various integer datatypes. C99's stdint.h does, but we can't rely on it. Several parts of the code defined limits locally, so instead centralize the definitions to c.h. This patch also changes the more obvious usages of literal limit values; there's more places that could be changed, but it's less clear whether it's beneficial to change those. Author: Andrew Gierth Discussion: [email protected]
2015-01-06Update copyright for 2015Bruce Momjian
Backpatch certain files through 9.0
2014-10-31Support frontend-backend protocol communication using a shm_mq.Robert Haas
A background worker can use pq_redirect_to_shm_mq() to direct protocol that would normally be sent to the frontend to a shm_mq so that another process may read them. The receiving process may use pq_parse_errornotice() to parse an ErrorResponse or NoticeResponse from the background worker and, if it wishes, ThrowErrorData() to propagate the error (with or without further modification). Patch by me. Review by Andres Freund.
2014-01-07Update copyright for 2014Bruce Momjian
Update all files in head, and files COPYRIGHT and legal.sgml in all back branches.
2013-01-01Update copyrights for 2013Bruce Momjian
Fully update git head, and update back branches in ./COPYRIGHT and legal.sgml files.
2012-01-01Update copyright notices for year 2012.Bruce Momjian
2011-04-10pgindent run before PG 9.1 beta 1.Bruce Momjian
2011-01-01Stamp copyrights for year 2011.Bruce Momjian
2010-11-20Assorted further cleanup for integer-conversion patch.Tom Lane
Avoid depending on LL notation, which is likely to not work in pre-C99 compilers; don't pointlessly use INT32_MIN/INT64_MIN in code that has the numerical value hard-wired into it anyway; remove some gratuitous style inconsistencies between pg_ltoa and pg_lltoa; fix int2 test case so it actually tests int2.
2010-11-20Attempt to fix breakage caused by signed integer conversion patch.Robert Haas
Use INT_MIN rather than INT32_MIN as we do elsewhere in the code, and try to work around nonexistence of INT64_MIN if necessary. Adjust the new regression tests to something hopefully saner, per observation by Tom Lane.
2010-11-20Speed up conversion of signed integers to C strings.Robert Haas
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.
2010-09-20Remove cvs keywords from all files.Magnus Hagander
2010-01-02Update copyright for the year 2010.Bruce Momjian
2009-01-01Update copyright for 2009.Bruce Momjian
2008-01-01Update copyrights in source tree to 2008.Bruce Momjian
2007-01-05Update CVS HEAD for 2007 copyright. Back branches are typically notBruce Momjian
back-stamped for this.
2006-03-11Remove a few places that attempted to define INT_MAX, SCHAR_MAX, andNeil Conway
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.
2006-03-05Update copyright for 2006. Update scripts.Bruce Momjian
2005-12-02Remove comment on errno=0 lines, but add mention to port/strtol.c function.Bruce Momjian
2005-12-01Add comment to pg_atoi.Bruce Momjian
2005-11-30Rearrange code in pg_atoi() to avoid assuming that isspace() cannotTom Lane
change errno. No reported bugs here, but why take a chance?
2005-10-15Standard pgindent run for 8.1.Bruce Momjian
2005-01-09Undo an unadvertised change in the API of pg_atoi. In all previousTom Lane
releases, a nonzero 'c' argument meant that the input string could be terminated by either that character or \0. Recent refactoring broke that, causing the thing to scan for 'c' only. This went undetected because no part of the main code actually passes nonzero 'c'. However it broke tsearch2 and possibly other user-written code that assumed the old definition. Per report from Tom Hebbron.
2004-12-31Tag appropriate files for rc3PostgreSQL Daemon
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 ...
2004-10-04Detect overflow in integer arithmetic operators (integer, smallint, andTom Lane
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.
2004-08-29Pgindent run for 8.0.Bruce Momjian
2004-08-29Update copyright to 2004.Bruce Momjian
2004-04-01Add missing casts to unsigned char in recently-added isspace() calls.Tom Lane
2004-03-11Revise int2/int4/int8/float4/float8 input routines to allow forNeil Conway
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.
2004-02-18Improve the consistency of the error message emitted when rejectingNeil Conway
invalid input to the oid type. Also, remove some long-unused code from adt/numutils.c
2004-01-07More janitorial work: remove the explicit casting of NULL literals to aNeil Conway
pointer type when it is not necessary to do so. For future reference, casting NULL to a pointer type is only necessary when (a) invoking a function AND either (b) the function has no prototype OR (c) the function is a varargs function.
2003-11-29$Header: -> $PostgreSQL Changes ...PostgreSQL Daemon
2003-09-25Message editing: remove gratuitous variations in message wording, standardizePeter Eisentraut
terms, add some clarifications, fix some untranslatable attempts at dynamic message building.
2003-08-04Update copyrights to 2003.Bruce Momjian
2003-08-04pgindent run.Bruce Momjian
2003-07-27Error message editing in utils/adt. Again thanks to Joe Conway for doingTom Lane
the bulk of the heavy lifting ...
2002-09-04pgindent run.Bruce Momjian
2002-08-27Bring comments back in sync with code.Tom Lane
2002-08-27Throw error on pg_atoi(''), regression adjustments.Bruce Momjian
2002-07-16Oops, sometimes strtol isn't called in pg_atoi, so we do need that badpBruce Momjian
check.
2002-07-16Fix tid to in/out as unsigned.Bruce Momjian