aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/formatting.c
Commit message (Collapse)AuthorAge
...
* Fix corner case bug in numeric to_char().Tom Lane2011-09-07
| | | | | | | | Trailing-zero stripping applied by the FM specifier could strip zeroes to the left of the decimal point, for a format with no digit positions after the decimal point (such as "FM999."). Reported and diagnosed by Marti Raudsepp, though I didn't use his patch.
* Fix to_date() and to_timestamp() to handle year masks of length < 4 soBruce Momjian2011-09-07
| | | | | they wrap toward year 2020, rather than the inconsistent behavior we had before.
* Fix char2wchar/wchar2char to support collations properly.Tom Lane2011-04-23
| | | | | | | | | | | | | | | | | These functions should take a pg_locale_t, not a collation OID, and should call mbstowcs_l/wcstombs_l where available. Where those functions are not available, temporarily select the correct locale with uselocale(). This change removes the bogus assumption that all locales selectable in a given database have the same wide-character conversion method; in particular, the collate.linux.utf8 regression test now passes with LC_CTYPE=C, so long as the database encoding is UTF8. I decided to move the char2wchar/wchar2char functions out of mbutils.c and into pg_locale.c, because they work on wchar_t not pg_wchar_t and thus don't really belong with the mbutils.c functions. Keeping them where they were would have required importing pg_locale_t into pg_wchar.h somehow, which did not seem like a good plan.
* pgindent run before PG 9.1 beta 1.Bruce Momjian2011-04-10
|
* Improve reporting of run-time-detected indeterminate-collation errors.Tom Lane2011-03-22
| | | | | | | | pg_newlocale_from_collation does not have enough context to give an error message that's even a little bit useful, so move the responsibility for complaining up to its callers. Also, reword ERRCODE_INDETERMINATE_COLLATION error messages in a less jargony, more message-style-guide-compliant fashion.
* Fix up handling of C/POSIX collations.Tom Lane2011-03-20
| | | | | | | | | | | | | | | | | Install just one instance of the "C" and "POSIX" collations into pg_collation, rather than one per encoding. Make these instances exist and do something useful even in machines without locale_t support: to wit, it's now possible to force comparisons and case-folding functions to use C locale in an otherwise non-C database, whether or not the platform has support for using any additional collations. Fix up severely broken upper/lower/initcap functions, too: the C/POSIX fastpath now does what it is supposed to, and non-default collations are handled correctly in single-byte database encodings. Merge the two separate collation hashtables that were being maintained in pg_locale.c, and be more wary of the possibility that we fail partway through filling a cache entry.
* Use macros for time-based constants, rather than constants.Bruce Momjian2011-03-12
|
* Per-column collation supportPeter Eisentraut2011-02-08
| | | | | | | | This adds collation support for columns and domains, a COLLATE clause to override it per expression, and B-tree index support. Peter Eisentraut reviewed by Pavel Stehule, Itagaki Takahiro, Robert Haas, Noah Misch
* Stamp copyrights for year 2011.Bruce Momjian2011-01-01
|
* Remove cvs keywords from all files.Magnus Hagander2010-09-20
|
* pgindent run for 9.0, second runBruce Momjian2010-07-06
|
* Fix to_char YYY, YY, Y format codes so that FM zero-suppression really works,Tom Lane2010-04-07
| | | | | | | rather than only sort-of working as the previous attempt had left it. Clean up some unnecessary differences between the way these were coded and the way the YYYY case was coded. Update the regression test cases that proved that it wasn't working.
* Document that "Q" is ignored by to_date and to_timestamp. Add C commentBruce Momjian2010-03-03
| | | | | | | about the behavior. Document that quotes in to_date, to_timestamp, to_number skip input characters.
* pgindent run for 9.0Bruce Momjian2010-02-26
|
* Add C comment that do_to_timestamp() lacks error checking.Bruce Momjian2010-02-25
|
* Revert recent change of to_char('HH12') handling for intervals; insteadBruce Momjian2010-02-23
| | | | improve documentation, and add C comment.
* Secondary patch to fix interval to_char() for "HH" where hours >= 12.Bruce Momjian2010-02-23
|
* Supress convertion of zero hours to '12' for intervals when usingBruce Momjian2010-02-23
| | | | | | | | | | | | | | to_char with HH, e.g. to_char(interval '0d 0h 12m 44s', 'DD HH24 MI SS'); now returns: 00 00 12 44 not: 00 12 12 44
* Honor to_char() "FM" specification in YYY, YY, and Y; it was alreadyBruce Momjian2010-02-16
| | | | | | honored by YYYY. Also document Oracle "toggle" FM behavior. Per report from Guy Rouillier
* Update copyright for the year 2010.Bruce Momjian2010-01-02
|
* Refactor NUM_cache_remove calls in error report path to a PG_TRY block.Alvaro Herrera2009-08-10
| | | | | The code in the new block was not reindented; it will be fixed by pgindent eventually.
* Support EEEE (scientific notation) in to_char().Tom Lane2009-08-10
| | | | Pavel Stehule, Brendan Jurd
* Fix ancient bug in handling of to_char modifier 'TH', when used with HH.Heikki Linnakangas2009-07-06
| | | | | In what seems like an oversight, we used to treat 'TH' the same as lowercase 'th', but only with HH/HH12.
* Make to_timestamp and friends skip leading spaces before an integer field,Tom Lane2009-06-22
| | | | | | | | | | | | | even when not in FM mode. This improves compatibility with Oracle and with our pre-8.4 behavior, as per bug #4862. Brendan Jurd Add a couple of regression test cases for this. In passing, get rid of the labeling of the individual test cases; doesn't seem to be good for anything except causing extra work when inserting a test... Tom Lane
* 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef listBruce Momjian2009-06-11
| | | | provided by Andrew.
* Clean up the code for to_timestamp's conversion of year plus ISO day numberTom Lane2009-03-15
| | | | | | | | | | | | to date, as per bug #4702 and subsequent discussion. In particular, make it work for years specified using AD/BC or CC fields, and fix the test for "no year specified" so that it doesn't trigger inappropriately for 1 BC (which it was doing even in code paths that had nothing to do with to_timestamp). I also did some minor code beautification in the non-ISO-day-number code path. This area has been busted all along, but because the code has been rewritten repeatedly, it would be considerable trouble to back-patch. It's such a corner case that it doesn't seem worth the effort.
* Fix core dump due to null-pointer dereference in to_char() when datetimeTom Lane2009-03-12
| | | | | | | | | | format codes are misapplied to a numeric argument. (The code still produces a pretty bogus error message in such cases, but I'll settle for stopping the crash for now.) Per bug #4700 from Sergey Burladyan. Problem exists in all supported branches, so patch all the way back. In HEAD, also clean up some ugly coding in the nearby cache management code.
* Fix to_timestamp() to not require upper/lower case matching for meridianBruce Momjian2009-02-07
| | | | | | | | | designations (AM/PM). Also separate out matching of a meridian with periods (e.g. A.M.) and with those without. Do the same for AD/BC. Brendan Jurd
* Update copyright for 2009.Bruce Momjian2009-01-01
|
* Remove our dependencies on MB_CUR_MAX in favor of believing thatTom Lane2008-12-15
| | | | | | | | | | pg_database_encoding_max_length() predicts the maximum character length returned by wchar2char(). Per Hiroshi Inoue, MB_CUR_MAX isn't usable on Windows because we allow encoding = UTF8 when the locale says differently; and getting rid of it seems a good idea on general principles because it narrows our dependence on libc's locale API just a little bit more. Also install a check for overflow of the buffer size computation.
* Modify the new to_timestamp implementation so that end-of-format-stringHeikki Linnakangas2008-12-01
| | | | | | | | | | | is treated like a non-digit separator. This fixes the inconsistency in examples like: to_timestamp('2008-01-2', 'YYYY-MM-DD') -- didn't work and to_timestamp('2008-1-02', 'YYYY-MM-DD') -- did work
* Fix 'Q' format char parsing in the new to_timestamp() code. Used to crash.Heikki Linnakangas2008-11-10
|
* Random speculation about the reason for PPC64 buildfarm failures:Tom Lane2008-10-06
| | | | maybe isalnum is returning a value with the low-order byte all zero?
* Fix pointer-advancement bugs in MS and US cases of new to_timestamp() code.Tom Lane2008-09-26
| | | | Alex Hunsaker
* Tighten up to_date/to_timestamp so that they are more likely to rejectTom Lane2008-09-11
| | | | | | | erroneous input, rather than silently producing bizarre results as formerly happened. Brendan Jurd
* Minor patch on pgbenchBruce Momjian2008-08-22
| | | | | | | | | | 1. -i option should run vacuum analyze only on pgbench tables, not *all* tables in database. 2. pre-run cleanup step was DELETE FROM HISTORY then VACUUM HISTORY. This is just a slow version of TRUNCATE HISTORY. Simon Riggs
* Const-ify the arguments of str_tolower() and friends to suppress compileTom Lane2008-07-12
| | | | | | | | warnings. Clean up various unneeded cruft that was left behind after creating those routines. Introduce some convenience functions str_tolower_z etc to eliminate tedious and error-prone double arguments in formatting.c. (Currently there seems no need to export the latter, but maybe reconsider this later.)
* Fix bug "select lower('asd') = 'asd'" returns false with multibyte encodingTeodor Sigaev2008-06-26
| | | | | and non-C locale. Fix is just to use correct source's length for char2wchar call.
* Merge duplicate upper/lower/initcap() routines in oracle_compat.c andBruce Momjian2008-06-23
| | | | | formatting.c to use common code; remove duplicate functions and support routines that are no longer needed.
* Move USE_WIDE_UPPER_LOWER define to c.h, and remove TS_USE_WIDE and useBruce Momjian2008-06-17
| | | | USE_WIDE_UPPER_LOWER instead.
* 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
|