summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt
AgeCommit message (Collapse)Author
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.
2008-11-14Actually, instead of whining about how type internal might not safely storeTom Lane
a pointer, why don't we just fix that. Every known use of "internal" really means a pointer anyway.
2008-11-14Implement the basic form of UNNEST, ie unnest(anyarray) returns setofTom Lane
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.
2008-11-14Minor code clarity improvements in array_agg functions, and add a commentTom Lane
about how this is playing fast and loose with the type system.
2008-11-13array_agg aggregate function, as per SQL:2008, but without ORDER BY clausePeter Eisentraut
Rearrange the documentation a bit now that array_agg and xmlagg have similar semantics and issues. best of Robert Haas, Jeff Davis, Peter Eisentraut
2008-11-12array_length() function, and for SQL compatibility also cardinality()Peter Eisentraut
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
2008-11-12Clean up the ancient decision to show only two fractional-seconds digitsTom Lane
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
2008-11-11Add support for input and output of interval values formatted per ISO 8601;Tom Lane
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
2008-11-10Fix a case of string building.Alvaro Herrera
2008-11-10Fix bugs in sqlchar_to_unicode and unicode_to_sqlchar: both were measuringTom Lane
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.
2008-11-10Fix 'Q' format char parsing in the new to_timestamp() code. Used to crash.Heikki Linnakangas
2008-11-09Add a new GUC variable called "IntervalStyle" that decouples interval outputTom Lane
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
2008-11-08Fix recently added code for SQL years-months interval syntax so thatTom Lane
it behaves correctly for a leading minus sign, zero year value, and nonzero month value. Per discussion with Ron Mayer.
2008-11-05This maneuver really requires a comment ...Tom Lane
2008-11-05change fix for suppress_redundant_updates_trigger() where relation has Oids, ↵Andrew Dunstan
to only apply if present Oid is invalid, per second thought from TGL
2008-11-05fix suppress_redundant_updates_trigger() where relation has Oids, per gripe ↵Andrew Dunstan
from KaiGai Kohei
2008-11-04ADD array_ndims functionPeter Eisentraut
Author: Robert Haas <robertmhaas@gmail.com>
2008-11-04Fix compiler warnings (including a seriously bogus elog call); minorTom Lane
code beautification.
2008-11-03Use bool for a boolean flag.Tom Lane
2008-11-03Allow uuid_in() to parse a wider variety of variant input formats for the UUIDPeter Eisentraut
data type. This patch takes the approach of allowing an optional hyphen after each group of four hex digits. Author: Robert Haas <robertmhaas@gmail.com>
2008-11-03suppress_redundant_updates_trigger function.Andrew Dunstan
2008-11-03Add pg_typeof() function.Tom Lane
Brendan Jurd
2008-11-02Remove all uses of the deprecated functions heap_formtuple, heap_modifytuple,Tom Lane
and heap_deformtuple in favor of the newer functions heap_form_tuple et al (which do the same things but use bool control flags instead of arbitrary char values). Eliminate the former duplicate coding of these functions, reducing the deprecated functions to mere wrappers around the newer ones. We can't get rid of them entirely because add-on modules probably still contain many instances of the old coding style. Kris Jurka
2008-10-29Unicode escapes in strings and identifiersPeter Eisentraut
2008-10-23When estimating without benefit of MCV lists (suggesting that one or bothTom Lane
inputs is unique or nearly so), make eqjoinsel() clamp the ndistinct estimates to be not more than the estimated number of rows coming from the input relations. This allows the estimate to change in response to the selectivity of restriction conditions on the inputs. This is a pretty narrow patch and maybe we should be more aggressive about similarly clamping ndistinct in other cases; but I'm worried about double-counting the effects of the restriction conditions. However, it seems to help for the case exhibited by Grzegorz Jaskiewicz (antijoin against a small subset of a relation), so let's try this for awhile.
2008-10-21Add a concept of "placeholder" variables to the planner. These are variablesTom Lane
that represent some expression that we desire to compute below the top level of the plan, and then let that value "bubble up" as though it were a plain Var (ie, a column value). The immediate application is to allow sub-selects to be flattened even when they are below an outer join and have non-nullable output expressions. Formerly we couldn't flatten because such an expression wouldn't properly go to NULL when evaluated above the outer join. Now, we wrap it in a PlaceHolderVar and arrange for the actual evaluation to occur below the outer join. When the resulting Var bubbles up through the join, it will be set to NULL if necessary, yielding the correct results. This fixes a planner limitation that's existed since 7.1. In future we might want to use this mechanism to re-introduce some form of Hellerstein's "expensive functions" optimization, ie place the evaluation of an expensive function at the most suitable point in the plan tree.
2008-10-14Extend the date type to support infinity and -infinity, analogously toTom Lane
the timestamp types. Turns out this doesn't even reduce the available range of dates, since the restriction to dates that work for Julian-date arithmetic is much tighter than the int32 range anyway. Per a longstanding TODO item.
2008-10-14Fix EncodeSpecialTimestamp to throw error on unrecognized input, rather thanTom Lane
returning a failure code that none of its callers bothered to check for.
2008-10-13Implement comparison of generic records (composite types), and invent aTom Lane
pseudo-type record[] to represent arrays of possibly-anonymous composite types. Since composite datums carry their own type identification, no extra knowledge is needed at the array level. The main reason for doing this right now is that it is necessary to support the general case of detection of cycles in recursive queries: if you need to compare more than one column to detect a cycle, you need to compare a ROW() to an array built from ROW()s, at least if you want to do it as the spec suggests. Add some documentation and regression tests concerning the cycle detection issue.