aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt
Commit message (Collapse)AuthorAge
...
* 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.
* In parse_bool_with_len, avoid crash when no result pointer is passed. ProbablyPeter Eisentraut2009-03-09
| | | | an unlikely call mode, but better be safe.
* Accept 'on' and 'off' as input for boolean data type, unifying the syntaxPeter Eisentraut2009-03-09
| | | | | | that the data type and GUC accepts. ITAGAKI Takahiro
* Put back our old workaround for machines that declare cbrt() in math.h butTom Lane2009-03-04
| | | | | | fail to provide the function itself. Not sure how we escaped testing anything later than 7.3 on such cases, but they still exist, as per André Volpato's report about AIX 5.3.
* Fix an old problem in decompilation of CASE constructs: the ruleutils.c codeTom Lane2009-02-25
| | | | | | | | | | | looks for a CaseTestExpr to figure out what the parser did, but it failed to consider the possibility that an implicit coercion might be inserted above the CaseTestExpr. This could result in an Assert failure in some cases (but correct results if Asserts weren't enabled), or an "unexpected CASE WHEN clause" error in other cases. Per report from Alan Li. Back-patch to 8.1; problem doesn't exist before that because CASE was implemented differently.
* Remove the special cases to prevent minus-zero results in float4 and float8Tom Lane2009-02-18
| | | | | | | | | | | | | | unary minus operators. We weren't attempting to prevent minus zero anywhere else; in view of our gradual trend to make the float datatypes more IEEE standard compliant, we should allow minus zero here rather than disallow it elsewhere. We don't, however, expect that all platforms will produce minus zero, so we need to adjust the one affected regression test to allow both results. Per discussion of bug #4660. (In passing, clean up a couple other minor infelicities in float.c.)
* Teach the planner to treat a partial unique index as proving a variable isTom Lane2009-02-15
| | | | | | | unique for a particular query, if the index predicate is satisfied. This requires a bit of reordering of operations so that we check the predicates before doing any selectivity estimates, but shouldn't really cause any noticeable slowdown. Per a comment from Michal Politowski.
* 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
* Clean up some loose ends from the column privileges patch: addTom Lane2009-02-06
| | | | | | | | | | | | | | | | | | | | | | has_column_privilege and has_any_column_privilege SQL functions; fix the information_schema views that are supposed to pay attention to column privileges; adjust pg_stats to show stats for any column you have select privilege on; and fix COPY to allow copying a subset of columns if the user has suitable per-column privileges for all the columns. To improve efficiency of some of the information_schema views, extend the has_xxx_privilege functions to allow inquiring about the OR of a set of privileges in just one call. This is just exposing capability that already existed in the underlying aclcheck routines. In passing, make the information_schema views report the owner's own privileges as being grantable, since Postgres assumes this even when the grant option bit is not set in the ACL. This is a longstanding oversight. Also, make the new has_xxx_privilege functions for foreign data objects follow the same coding conventions used by the older ones. Stephen Frost and Tom Lane
* Fix unnest() to handle a toasted input array safely. Per report fromTom Lane2009-01-30
| | | | Alvaro.
* Silence compiler warnings in new win32 locale codeMagnus Hagander2009-01-27
| | | | | | when building on mingw. ITAGAKI Takahiro
* Support column-level privileges, as required by SQL standard.Tom Lane2009-01-22
| | | | Stephen Frost, with help from KaiGai Kohei and others
* Remove stray ' character at end of line.Magnus Hagander2009-01-21
| | | | | For some reason it broke OpenBSD compile even when it's inside a #ifdef WIN32 block.....
* Make win32 builds always do SetEnvironmentVariable() when doing putenv().Magnus Hagander2009-01-21
| | | | | | | | | | | Also, if linked against other versions than the default MSVCRT library (for example the MSVC build which links against MSVCRT80), also update the cache in the default MSVCRT at the same time. This should fix the issues with setting LC_MESSAGES on the MSVC build. Original patch from Hiroshi Inoue and Hiroshi Saito, much rewritten by me.
* Code review of strftime patch, per comments from Tom:Magnus Hagander2009-01-09
| | | | | * Use correct buffer size MAX_L10N_DATA * Use strlcpy instead of StrNCpy
* Fix strftime usage on Win32 when trying to fetch the locale-awareMagnus Hagander2009-01-09
| | | | | | | parts of a time string so it properly handles different encodings. Original patch by Hiroshi Saito, heavily reworked by me and ITAGAKI Takahiro.
* Revert current_query() change to use debug_query_string again; add comment.Bruce Momjian2009-01-08
|
* Have current_query() use ActivePortal->sourceText rather thanBruce Momjian2009-01-07
| | | | | debug_query_string; this allows current_query() to be more accurate; docs updated; per idea from Tom
* Add comment that it is difficult to access the more accurateBruce Momjian2009-01-07
| | | | 'query_string' from current_query().
* Fix executor/spi.h to follow our usual conventions for include files, ie,Tom Lane2009-01-07
| | | | | | | | | not include postgres.h nor anything else it doesn't directly need. Add #includes to calling files as needed to compensate. Per my proposal of yesterday. This should be noted as a source code change in the 8.4 release notes, since it's likely to require changes in add-on modules.
* Revert the default toast compression strategy to the former behaviorTom Lane2009-01-06
| | | | | where there's no limit on the size of datum we'll try to compress. Other 8.4 tweaks to the behavior remain in place. Per discussion.
* Update copyright for 2009.Bruce Momjian2009-01-01
|
* Add a WINDOW attribute to CREATE FUNCTION, and teach pg_dump about it,Tom Lane2008-12-31
| | | | | | | | | | | so that user-defined window functions are possible. For the moment you'll have to write them in C, for lack of any interface to the WindowObject API in the available PLs, but it's better than no support at all. There was some debate about the best syntax for this. I ended up choosing the "it's an attribute" position --- the other approach will inevitably be more work, and the likely market for user-defined window functions is probably too small to justify it.
* Add some basic support for window frame clauses to the window-functionsTom Lane2008-12-31
| | | | | | | | patch. This includes the ability to force the frame to cover the whole partition, and the ability to make the frame end exactly on the current row rather than its last ORDER BY peer. Supporting any more of the full SQL frame-clause syntax will require nontrivial hacking on the window aggregate code, so it'll have to wait for 8.5 or beyond.
* Support window functions a la SQL:2008.Tom Lane2008-12-28
| | | | Hitoshi Harada, with some kibitzing from Heikki and Tom.
* SQL/MED catalog manipulation facilitiesPeter Eisentraut2008-12-19
| | | | | | | | This doesn't do any remote or external things yet, but it gives modules like plproxy and dblink a standardized and future-proof system for managing their connection information. Martin Pihlak and Peter Eisentraut
* When we added the ability to have zero-element ARRAY[] constructs by adding anTom Lane2008-12-19
| | | | | | explicit cast to show the intended array type, we forgot to teach ruleutils.c to print out such constructs properly. Found by noting bogus output from recent changes in polymorphism regression test.
* Code review for function default parameters patch. Fix numerous problems asTom Lane2008-12-18
| | | | | per recent discussions. In passing this also fixes a couple of bugs in the previous variadic-parameters patch.
* Arrange for the pg_foo_is_visible and has_foo_privilege families of functionsTom Lane2008-12-15
| | | | | | | | | | | to return NULL, instead of erroring out, if the target object is specified by OID and we can't find that OID in the catalogs. Since these functions operate internally on SnapshotNow rules, there is a race condition when using them in user queries: the query's MVCC snapshot might "see" a catalog row that's already committed dead, leading to a failure when the inquiry function is applied. Returning NULL should generally provide more convenient behavior. This issue has been complained of before, and in particular we are now seeing it in the regression tests due to another recent patch.
* 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.
* Better descriptions in pg_get_keywords(), consistent with the documentationPeter Eisentraut2008-12-05
| | | | | appendix on key words. catdesc was originally intended as computer-readable, but since we ended up adding catcode, we can have more elaborate descriptions.
* Default values for function argumentsPeter Eisentraut2008-12-04
| | | | Pavel Stehule, with some tweaks by Peter Eisentraut
* Use PG_GETARG_TEXT_PP instead of PG_GETARG_TEXT_P in the newHeikki Linnakangas2008-12-02
| | | | | gin_cmp_tslexeme and gin_cmp_prefix functions. Should shave off a few cycles from GIN operations.
* 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 compiler warning "res may be used uninitialized in this function".Teodor Sigaev2008-11-19
| | | | | Actually, it can't but some compilers are not smart enough. Per Peter Eisentraut gripe.
* Replace plain-memory ordered array by binary tree in ts_stat() function.Teodor Sigaev2008-11-17
| | | | Performance is increased from 50% up to 10^3 times depending on data.
* Actually, instead of whining about how type internal might not safely storeTom Lane2008-11-14
| | | | | a pointer, why don't we just fix that. Every known use of "internal" really means a pointer anyway.
* Implement the basic form of UNNEST, ie unnest(anyarray) returns setofTom Lane2008-11-14
| | | | | | | anyelement. This lacks the WITH ORDINALITY option, as well as the multiple input arrays option added in the most recent SQL specs. But it's still a pretty useful subset of the spec's functionality, and it is enough to allow obsoleting contrib/intagg.
* Minor code clarity improvements in array_agg functions, and add a commentTom Lane2008-11-14
| | | | about how this is playing fast and loose with the type system.
* array_agg aggregate function, as per SQL:2008, but without ORDER BY clausePeter Eisentraut2008-11-13
| | | | | | | Rearrange the documentation a bit now that array_agg and xmlagg have similar semantics and issues. best of Robert Haas, Jeff Davis, Peter Eisentraut
* array_length() function, and for SQL compatibility also cardinality()Peter Eisentraut2008-11-12
| | | | | | | | | | function as a special case. This version still has the suspicious behavior of returning null for an empty array (rather than zero), but this may need a wholesale revision of empty array behavior, currently under discussion. Jim Nasby, Robert Haas, Peter Eisentraut
* Clean up the ancient decision to show only two fractional-seconds digitsTom Lane2008-11-12
| | | | | | | | | | | | | in "postgres_verbose" intervalstyle, and the equally arbitrary decision to show at least two fractional-seconds digits in most other datetime display styles. This results in some minor changes in the expected regression test outputs. Also, coalesce a lot of repetitive code in datetime.c into subroutines, for clarity and ease of maintenance. In particular this roughly halves the number of #ifdef HAVE_INT64_TIMESTAMP segments. Ron Mayer, with some additional kibitzing from Tom Lane
* Add support for input and output of interval values formatted per ISO 8601;Tom Lane2008-11-11
| | | | | | | | specifically, we can input either the "format with designators" or the "alternative format", and we can output the former when IntervalStyle is set to iso_8601. Ron Mayer
* Fix a case of string building.Alvaro Herrera2008-11-10
|
* Fix bugs in sqlchar_to_unicode and unicode_to_sqlchar: both were measuringTom Lane2008-11-10
| | | | | | the length of a UTF8 character with pg_mblen (wrong if DB encoding isn't UTF8), and the latter was blithely assuming that a static buffer would somehow revert to all zeroes for each use.
* Fix 'Q' format char parsing in the new to_timestamp() code. Used to crash.Heikki Linnakangas2008-11-10
|
* Add a new GUC variable called "IntervalStyle" that decouples interval outputTom Lane2008-11-09
| | | | | | | | | | from DateStyle, and create a new interval style that produces output matching the SQL standard (at least for interval values that fall within the standard's restrictions). IntervalStyle is also used to resolve the conflict between the standard and traditional Postgres rules for interpreting negative interval input. Ron Mayer
* Fix recently added code for SQL years-months interval syntax so thatTom Lane2008-11-08
| | | | | it behaves correctly for a leading minus sign, zero year value, and nonzero month value. Per discussion with Ron Mayer.
* This maneuver really requires a comment ...Tom Lane2008-11-05
|