summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt
AgeCommit message (Collapse)Author
2009-04-09Remove SQL-compatibility function cardinality(). It is not exactly clearTom Lane
how this ought to behave for multi-dimensional arrays. Per discussion, not having it at all seems better than having it with what might prove to be the wrong behavior. We can always add it later when we have consensus on the correct behavior.
2009-04-08Allow leading and trailing spaces around NaN in numeric_in.Tom Lane
Sam Mason, rewritten a bit by Tom.
2009-04-08XMLATTRIBUTES() should send the attribute values throughPeter Eisentraut
map_sql_value_to_xml_value() instead of directly through the data type output function. This is per SQL standard, and consistent with XMLELEMENT().
2009-04-05Change cardinality() into a C-code function, instead of a SQL-languageTom Lane
alias for array_length(v,1). The efficiency gain here is doubtless negligible --- what I'm interested in is making sure that if we have second thoughts about the definition, we will not have to force a post-beta initdb to change the implementation.
2009-04-05Change EXPLAIN output so that subplans and initplans (particularly CTEs)Tom Lane
are individually labeled, rather than just grouped under an "InitPlan" or "SubPlan" heading. This in turn makes it possible for decompilation of a subplan reference to usefully identify which subplan it's referencing. I also made InitPlans identify which parameter symbol(s) they compute, so that references to those parameters elsewhere in the plan tree can be connected to the initplan that will be executed. Per a gripe from Robert Haas about EXPLAIN output of a WITH query being inadequate, plus some longstanding pet peeves of my own.
2009-04-04Rewrite interval_hash() so that the hashcodes are equal for values thatTom Lane
interval_eq() considers equal. I'm not sure how that fundamental requirement escaped us through multiple revisions of this hash function, but there it is; it's been wrong since interval_hash was first written for PG 7.1. Per bug #4748 from Roman Kononov. Backpatch to all supported releases. This patch changes the contents of hash indexes for interval columns. That's no particular problem for PG 8.4, since we've broken on-disk compatibility of hash indexes already; but it will require a migration warning note in the next minor releases of all existing branches: "if you have any hash indexes on columns of type interval, REINDEX them after updating".
2009-04-01Update comment to reflect that LC_COLLATE and LC_CTYPE are nowHeikki Linnakangas
per-database settings.
2009-03-27Add an errdetail explaining why we reject infinite dates and timestampsTom Lane
while converting to XML. Bernd Helmle
2009-03-25Adjust the APIs for GIN opclass support functions to allow the extractQuery()Tom Lane
method to pass extra data to the consistent() and comparePartial() methods. This is the core infrastructure needed to support the soon-to-appear contrib/btree_gin module. The APIs are still upward compatible with the definitions used in 8.3 and before, although *not* with the previous 8.4devel function definitions. catversion bump for changes in pg_proc entries (although these are just cosmetic, since GIN doesn't actually look at the function signature before calling it...) Teodor Sigaev and Oleg Bartunov
2009-03-23Remove munging of xml and xpath params to xpath(). The XML must now be a ↵Andrew Dunstan
well formed XML document.
2009-03-22Remove the datetime keywords ABSTIME and RELTIME, which we'd been treating asTom Lane
noise words for the last twelve years, for compatibility with Berkeley-era output formatting of the special INVALID values for those datatypes. Considering that the datatypes themselves have been deprecated for awhile, this is taking backwards compatibility a little far. Per gripe from Josh Berkus.
2009-03-17Improve zero-year comments.Bruce Momjian
2009-03-17Document that datetime year '0' is considered in a recent century, notBruce Momjian
just '00'.
2009-03-15Clean up the code for to_timestamp's conversion of year plus ISO day numberTom Lane
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.
2009-03-12Fix core dump due to null-pointer dereference in to_char() when datetimeTom Lane
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.
2009-03-09In parse_bool_with_len, avoid crash when no result pointer is passed. ProbablyPeter Eisentraut
an unlikely call mode, but better be safe.
2009-03-09Accept 'on' and 'off' as input for boolean data type, unifying the syntaxPeter Eisentraut
that the data type and GUC accepts. ITAGAKI Takahiro
2009-03-04Put back our old workaround for machines that declare cbrt() in math.h butTom Lane
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.
2009-02-25Fix an old problem in decompilation of CASE constructs: the ruleutils.c codeTom Lane
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.
2009-02-18Remove the special cases to prevent minus-zero results in float4 and float8Tom Lane
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.)
2009-02-15Teach the planner to treat a partial unique index as proving a variable isTom Lane
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.
2009-02-07Fix to_timestamp() to not require upper/lower case matching for meridianBruce Momjian
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
2009-02-06Clean up some loose ends from the column privileges patch: addTom Lane
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
2009-01-30Fix unnest() to handle a toasted input array safely. Per report fromTom Lane
Alvaro.
2009-01-27Silence compiler warnings in new win32 locale codeMagnus Hagander
when building on mingw. ITAGAKI Takahiro
2009-01-22Support column-level privileges, as required by SQL standard.Tom Lane
Stephen Frost, with help from KaiGai Kohei and others
2009-01-21Remove stray ' character at end of line.Magnus Hagander
For some reason it broke OpenBSD compile even when it's inside a #ifdef WIN32 block.....
2009-01-21Make win32 builds always do SetEnvironmentVariable() when doing putenv().Magnus Hagander
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.
2009-01-09Code review of strftime patch, per comments from Tom:Magnus Hagander
* Use correct buffer size MAX_L10N_DATA * Use strlcpy instead of StrNCpy
2009-01-09Fix strftime usage on Win32 when trying to fetch the locale-awareMagnus Hagander
parts of a time string so it properly handles different encodings. Original patch by Hiroshi Saito, heavily reworked by me and ITAGAKI Takahiro.
2009-01-08Revert current_query() change to use debug_query_string again; add comment.Bruce Momjian
2009-01-07Have current_query() use ActivePortal->sourceText rather thanBruce Momjian
debug_query_string; this allows current_query() to be more accurate; docs updated; per idea from Tom
2009-01-07Add comment that it is difficult to access the more accurateBruce Momjian
'query_string' from current_query().
2009-01-07Fix executor/spi.h to follow our usual conventions for include files, ie,Tom Lane
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.
2009-01-06Revert the default toast compression strategy to the former behaviorTom Lane
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.
2009-01-01Update copyright for 2009.Bruce Momjian
2008-12-31Add a WINDOW attribute to CREATE FUNCTION, and teach pg_dump about it,Tom Lane
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.
2008-12-31Add some basic support for window frame clauses to the window-functionsTom Lane
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.
2008-12-28Support window functions a la SQL:2008.Tom Lane
Hitoshi Harada, with some kibitzing from Heikki and Tom.
2008-12-19SQL/MED catalog manipulation facilitiesPeter Eisentraut
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
2008-12-19When we added the ability to have zero-element ARRAY[] constructs by adding anTom Lane
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.
2008-12-18Code review for function default parameters patch. Fix numerous problems asTom Lane
per recent discussions. In passing this also fixes a couple of bugs in the previous variadic-parameters patch.
2008-12-15Arrange for the pg_foo_is_visible and has_foo_privilege families of functionsTom Lane
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.
2008-12-15Remove our dependencies on MB_CUR_MAX in favor of believing thatTom Lane
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.
2008-12-05Better descriptions in pg_get_keywords(), consistent with the documentationPeter Eisentraut
appendix on key words. catdesc was originally intended as computer-readable, but since we ended up adding catcode, we can have more elaborate descriptions.
2008-12-04Default values for function argumentsPeter Eisentraut
Pavel Stehule, with some tweaks by Peter Eisentraut
2008-12-02Use PG_GETARG_TEXT_PP instead of PG_GETARG_TEXT_P in the newHeikki Linnakangas
gin_cmp_tslexeme and gin_cmp_prefix functions. Should shave off a few cycles from GIN operations.
2008-12-01Modify the new to_timestamp implementation so that end-of-format-stringHeikki Linnakangas
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
2008-11-19Fix compiler warning "res may be used uninitialized in this function".Teodor Sigaev
Actually, it can't but some compilers are not smart enough. Per Peter Eisentraut gripe.
2008-11-17Replace plain-memory ordered array by binary tree in ts_stat() function.Teodor Sigaev
Performance is increased from 50% up to 10^3 times depending on data.