summaryrefslogtreecommitdiff
path: root/src/backend/utils
AgeCommit message (Collapse)Author
2008-12-03Introduce visibility map. The visibility map is a bitmap with one bit perHeikki Linnakangas
heap page, where a set bit indicates that all tuples on the page are visible to all transactions, and the page therefore doesn't need vacuuming. It is stored in a new relation fork. Lazy vacuum uses the visibility map to skip pages that don't need vacuuming. Vacuum is also responsible for setting the bits in the map. In the future, this can hopefully be used to implement index-only-scans, but we can't currently guarantee that the visibility map is always 100% up-to-date. In addition to the visibility map, there's a new PD_ALL_VISIBLE flag on each heap page, also indicating that all tuples on the page are visible to all transactions. It's important that this flag is kept up-to-date. It is also used to skip visibility tests in sequential scans, which gives a small performance gain on seqscans.
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-02Minor code embellishments.Alvaro Herrera
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-30Remove inappropriate memory context switch in shutdown_MultiFuncCall().Tom Lane
This was a thinko introduced in a patch from last February; it results in memory leakage if an SRF is shut down before the actual end of query, because subsequent code will be running in a longer-lived context than it's expecting to be.
2008-11-26Rely on relcache invalidation to update the cached size of the FSM.Heikki Linnakangas
2008-11-25Use ResourceOwners in the snapshot manager, instead of attempting to track themAlvaro Herrera
by hand. As an added bonus, the new code is smaller and more understandable, and the ugly loops are gone. This had been discussed all along but never implemented. It became clear that it really needed to be fixed after a bug report by Pavan Deolasee.
2008-11-21Fix a few more format argument warnings.Magnus Hagander
2008-11-21Make the enumvals column of pg_settings be text[] instead of justMagnus Hagander
a comma separated string.
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-19Fix define_custom_variable so that SUSET custom variables behaveTom Lane
somewhat reasonably. It's not perfect, but it beats the kluge proposed in the auto-explain patch ...
2008-11-19Some infrastructure changes for the upcoming auto-explain contrib module:Tom Lane
* Refactor explain.c slightly to export a convenient-to-use subroutine for printing EXPLAIN results. * Provide hooks for plugins to get control at ExecutorStart and ExecutorEnd as well as ExecutorRun. * Add some minimal support for tracking the total runtime of ExecutorRun. This code won't actually do anything unless a plugin prods it to. * Change the API of the DefineCustomXXXVariable functions to allow nonzero "flags" to be specified for a custom GUC variable. While at it, also make the "bootstrap" default value for custom GUCs be explicitly specified as a parameter to these functions. This is to eliminate confusion over where the default comes from, as has been expressed in the past by some users of the custom-variable facility. * Refactor GUC code a bit to ensure that a custom variable gets initialized to something valid (like its default value) even if the placeholder value was invalid.
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 an explicit caution about how to use pg_do_encoding_conversion withTom Lane
non-null-terminated input. Per discussion with ITAGAKI Takahiro.
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-10pg_do_encoding_conversion cannot return NULL (at least not unless the inputTom Lane
is NULL), so remove some useless tests for the case.
2008-11-10Make relhasrules and relhastriggers work like relhasindex, namely we letTom Lane
VACUUM reset them to false rather than trying to clean 'em up during DROP.
2008-11-09Replace pg_class.reltriggers with relhastriggers, which is just a boolean hintTom Lane
("there might be triggers") rather than an exact count. This is necessary catalog infrastructure for the upcoming patch to reduce the strength of locking needed for trigger addition/removal. Split out and committed separately for ease of reviewing/testing. In passing, also get rid of the unused pg_class columns relukeys, relfkeys, and relrefs, which haven't been maintained in many years and now have no chance of ever being maintained (because of wishing to avoid locking). Simon Riggs
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-31Allow SQL-language functions to return the output of an INSERT/UPDATE/DELETETom Lane
RETURNING clause, not just a SELECT as formerly. A side effect of this patch is that when a set-returning SQL function is used in a FROM clause, performance is improved because the output is collected into a tuplestore within the function, rather than using the less efficient value-per-call mechanism.
2008-10-29Unicode escapes in strings and identifiersPeter Eisentraut
2008-10-29Be more tense about not creating tuplestores with randomAccess = true unlessTom Lane
backwards scan could actually happen. In particular, pass a flag to materialize-mode SRFs that tells them whether they need to require random access. In passing, also suppress unneeded backward-scan overhead for a Portal's holdStore tuplestore. Per my proposal about reducing I/O costs for tuplestores.
2008-10-28Extend ExecMakeFunctionResult() to support set-returning functions that returnTom Lane
via a tuplestore instead of value-per-call. Refactor a few things to reduce ensuing code duplication with nodeFunctionscan.c. This represents the reasonably noncontroversial part of my proposed patch to switch SQL functions over to returning tuplestores. For the moment, SQL functions still do things the old way. However, this change enables PL SRFs to be called in targetlists (observe changes in plperl regression results).
2008-10-28Arrange to squeeze out the MINIMAL_TUPLE_PADDING in the tuple representationTom Lane
written to temp files by tuplesort.c and tuplestore.c. This saves 2 bytes per row for 32-bit machines, and 6 bytes per row for 64-bit machines, which seems worth the slight additional uglification of the tuple read/write routines.
2008-10-27Downgrade can't-happen error reports to elog().Alvaro Herrera
2008-10-27Install a more robust solution for the problem of infinite error-processingTom Lane
recursion when we are unable to convert a localized error message to the client's encoding. We've been over this ground before, but as reported by Ibrar Ahmed, it still didn't work in the case of conversion failures for the conversion-failure message itself :-(. Fix by installing a "circuit breaker" that disables attempts to localize this message once we get into recursion trouble. Patch all supported branches, because it is in fact broken in all of them; though I had to add some missing translations to the older branches in order to expose the failure in the particular test case I was using.
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-17Refactor some duplicate code to set up formatted_log_time andAlvaro Herrera
formatted_start_time.
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.