aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/formatting.c
Commit message (Collapse)AuthorAge
...
* Simplify code in formatting.c now that to upper/lower/initcase do notBruce Momjian2008-05-20
| | | | modify the passed string.
* Make to_char()'s localized month/day names depend on LC_TIME, not LC_MESSAGES.Tom Lane2008-05-19
| | | | Euler Taveira de Oliveira
* 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
* Refactor to_char/to_date formatting code; primarily, replace DCH_processorTom Lane2008-03-22
| | | | | with two new functions DCH_to_char and DCH_from_char that have less confusing APIs. Brendan Jurd
* Update copyrights in source tree to 2008.Bruce Momjian2008-01-01
|
* Add more comments about thousands separator handling.Bruce Momjian2007-11-22
|
* Add comments about thousands separator logic.Bruce Momjian2007-11-22
|
* When setting default thousands separator when locale has "", use logicBruce Momjian2007-11-21
| | | | so new thousands separator doesn't match decimal symbol.
* Fix typo in comment.Bruce Momjian2007-11-21
|
* pgindent run for 8.3.Bruce Momjian2007-11-15
|
* Switch over to using the src/timezone functions for formatting timestampsTom Lane2007-08-04
| | | | | | | | | | | | | | displayed in the postmaster log. This avoids Windows-specific problems with localized time zone names that are in the wrong encoding, and generally seems like a good idea to forestall other potential platform-dependent issues. To preserve the existing behavior that all backends will log in the same time zone, create a new GUC variable log_timezone that can only be changed on a system-wide basis, and reference log-related calculations to that zone instead of the TimeZone variable. This fixes the issue reported by Hiroshi Saito that timestamps printed by xlog.c startup could be improperly localized on Windows. We still need a simpler patch for that problem in the back branches, however.
* Fix a passel of ancient bugs in to_char(), including two distinct bufferTom Lane2007-06-29
| | | | | | | | | | | overruns (neither of which seem likely to be exploitable as security holes, fortunately, since the provoker can't control the data written). One of these is due to choosing to stomp on the output of a called function, which is bad news in any case; make it treat the called functions' results as read-only. Avoid some unnecessary palloc/pfree traffic too; it's not really helpful to free small temporary objects, and again this is presuming more than it ought to about the nature of the results of called functions. Per report from Patrick Welche and additional code-reading by Imad.
* 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
* Remove rint() for to_char MS and US output. We can't us rint() becauseBruce Momjian2007-02-17
| | | | | we can't overflow to the next higher units, and we might print the lower units for MS.
* Cleanup of to_char() patch.Bruce Momjian2007-02-17
| | | | Brendan Jurd
* Fix // commentPeter Eisentraut2007-02-16
|
* Add two new format fields for use with to_char(), to_date() andBruce Momjian2007-02-16
| | | | | | | | | | | | | | to_timestamp(): - ID for day-of-week - IDDD for day-of-year This makes it possible to convert ISO week dates to and from text fully represented in either week ('IYYY-IW-ID') or day-of-year ('IYYY-IDDD') format. I have also added an 'isoyear' field for use with extract / date_part. Brendan Jurd
* Fix to_date()/to_timestamp() 'D' field for day of week, was off by one.Bruce Momjian2007-02-14
| | | | | | Converting from char using 'D' doesn't make lots of sense, of course. Report from Brendan Jurd.
* Add comment that to_char() for broken glibc pt_BR might cause a problem.Bruce Momjian2007-02-13
|
* Remove blank lines in code.Bruce Momjian2007-02-09
|
* Remove blank line from C code.Bruce Momjian2007-02-09
|
* Fix bug when localized to_char() day or month names were incorectlyBruce Momjian2007-02-08
| | | | | | trnasformed to lower or upper string. Pavel Stehule
* Fix bug in our code when using to_timestamp() or to_date() without "TM".Bruce Momjian2007-02-08
| | | | | Assume "TM" when input fields are variable-length, like month or day names. This matches Oracle behavior.
* Fix handling of CC (century) format spec in to_date/to_char. According toTom Lane2007-01-12
| | | | | | | | standard convention the 21st century runs from 2001-2100, not 2000-2099, so make it work like that. Per bug #2885 from Akio Iwaasa. Backpatch to 8.2, but no further, since this is really a definitional change; users of older branches are probably more interested in stability.
* Update CVS HEAD for 2007 copyright. Back branches are typically notBruce Momjian2007-01-05
| | | | back-stamped for this.
* Add workaround for localizing May and abbreviated May differently. IdeaPeter Eisentraut2006-11-28
| | | | of Dennis Björklund.
* Revert (too late in beta):Bruce Momjian2006-11-24
| | | | | | Fix to_char() locale handling to honor LC_TIME, not LC_MESSAGES. Euler Taveira de Oliveira
* Fix to_char() locale handling to honor LC_TIME, not LC_MESSAGES.Bruce Momjian2006-11-24
| | | | Euler Taveira de Oliveira
* pgindent run for 8.2.Bruce Momjian2006-10-04
|
* Back out patch added during 8.2.X development:Bruce Momjian2006-09-10
| | | | | | | Allow to_char() "D" format specifiers for interval/time. It doesn't work, and I doubt it is useful enough to fix ("D" = day of week).
* Fix case where "PM" to_timestamp() mask was eating too many characters.Bruce Momjian2006-09-03
| | | | Report from Josh Tolley.
* Fix problem that sscanf(buf, "%d", &val) eats leading white space, butBruce Momjian2006-04-19
| | | | our to_* functions were not handling that.
* C code whitespace inprovement for formatting.c.Bruce Momjian2006-04-19
|
* Update copyright for 2006. Update scripts.Bruce Momjian2006-03-05
|
* Add comment about localized month names for to_date and to_timestamp.Bruce Momjian2006-03-03
|
* Revert because C locale uses "" for thousands_sep, meaning "n/a", whileBruce Momjian2006-02-12
| | | | | French uses "" for "don't want". Seems we have to keep the existing behavior.
* Support "" for thousands separator and plus sign in to_char(), perBruce Momjian2006-02-12
| | | | report from French Debian user. psql already handles "" fine.
* Allow to_char() to print localized month and day names.Bruce Momjian2006-02-12
| | | | Euler Taveira de Oliveira
* Allow to_char(interval) and to_char(time) to use AM/PM specifications.Bruce Momjian2005-12-03
| | | | | | | | | | | Map them to a single day, so '30 hours' is 'AM'. Have to_char(interval) and to_char(time) use "HH", "HH12" as 12-hour intervals, rather than bypass and print the full interval hours. This is neeeded because to_char(time) is mapped to interval in this function. Intervals should use "HH24", and document suggestion. Allow "D" format specifiers for interval/time.
* 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.
* Adjust not-too-sane calculation of DDD value for to_char(interval).Tom Lane2005-10-20
| | | | Per gripe from Chris Matheson.
* Standard pgindent run for 8.1.Bruce Momjian2005-10-15
|
* Add hint for to_char(interval) invalid format specifications.Bruce Momjian2005-08-18
|
* Fix to_char(interval) to return proper year and century values.Bruce Momjian2005-08-18
| | | | | | | | Fix to_char(interval) to return large year/month/day/hour values that are larger than possible timestamp values. Prevent to_char(interval) format specifications that make no sense, like Month. Clean up formatting.c code to more logically handle return lengths.
* More formatting.c cleanups.Bruce Momjian2005-08-17
|
* Small cleanup.Bruce Momjian2005-08-17
|
* Adjust to_char/from_char code to use boolean "is_to_char" rather thanBruce Momjian2005-08-17
| | | | integer with flags.
* Fix a few macro definitions to ensure that unary minus is enclosed inNeil Conway2005-07-27
| | | | | parentheses. This avoids possible operator precedence problems, and is consistent with most of the macro definitions in the tree.
* Andrew pointed out that the current fix didn't handle dates that wereBruce Momjian2005-07-23
| | | | | | | | | | | near daylight savings time boudaries. This handles it properly, e.g. test=> select '2005-04-03 04:00:00'::timestamp at time zone 'America/Los_Angeles'; timezone ------------------------ 2005-04-03 07:00:00-04 (1 row)
* Add time/date macros for code clarity:Bruce Momjian2005-07-21
| | | | | | | #define DAYS_PER_YEAR 365.25 #define MONTHS_PER_YEAR 12 #define DAYS_PER_MONTH 30 #define HOURS_PER_DAY 24