summaryrefslogtreecommitdiff
path: root/src/backend/utils
AgeCommit message (Collapse)Author
2009-01-08Revert current_query() change to use debug_query_string again; add comment.Bruce Momjian
2009-01-07Create a third option named "partition" for constraint_exclusion, and make itTom Lane
the default. This setting enables constraint exclusion checks only for appendrel members (ie, inheritance children and UNION ALL arms), which are the cases in which constraint exclusion is most likely to be useful. Avoiding the overhead for simple queries that are unlikely to benefit should bring the cost down to the point where this is a reasonable default setting. Per today's discussion.
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-07Insert conditional SPI_push/SPI_pop calls into InputFunctionCall,Tom Lane
OutputFunctionCall, and friends. This allows SPI-using functions to invoke datatype I/O without concern for the possibility that a SPI-using function will be called (which could be either the I/O function itself, or a function used in a domain check constraint). It's a tad ugly, but not nearly as ugly as what'd be needed to make this work via retail insertion of push/pop operations in all the PLs. This reverts my patch of 2007-01-30 that inserted some retail SPI_push/pop calls into plpgsql; that approach only fixed plpgsql, and not any other PLs. But the other PLs have the issue too, as illustrated by a recent gripe from Christian Schröder. Back-patch to 8.2, which is as far back as this solution will work. It's also as far back as we need to worry about the domain-constraint case, since earlier versions did not attempt to check domain constraints within datatype input. I'm not aware of any old I/O functions that use SPI themselves, so this should be sufficient for a back-patch.
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-07Make the log output of 'vxid' between csvlog and stderr/syslogBruce Momjian
consistent. Currently, in csvlog, vxid of an auxiliary process isn't displayed. On the other hand, in stderr/syslog, invalid vxid (-1/0) of that is displayed. Fujii Masao
2009-01-06Change a couple of ill-advised uses of INFO elog level to WARNINGs; inTom Lane
particular this allows EmitWarningsOnPlaceholders messages to show up in the postmaster log by default. Update elog.h comment to make it clearer what INFO is for, and fix one example in the SGML docs that was misusing it. Per my gripe of yesterday.
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-05Quiet repeated "loaded library" messages from child backends that are justTom Lane
re-loading a library already loaded into the postmaster. ITAGAKI Takahiro
2009-01-05Fix define_custom_variable to preserve any sourcefile/sourceline informationTom Lane
present in the placeholder. Noted while testing pg_stat_statements.
2009-01-04Add a pg_encoding_mbcliplen() function that is just like pg_mbcliplen()Tom Lane
except the caller can specify the encoding to work in; this will be needed for pg_stat_statements. In passing, do some marginal efficiency hacking and clean up some comments. Also, prevent the single-byte-encoding code path from fetching one byte past the stated length of the string (this last is a bug that might need to be back-patched at some point).
2009-01-03Allow loadable modules to create PGC_POSTMASTER GUC variables, but onlyTom Lane
when loaded via shared_preload_libraries. Needed for support of pg_stat_statements, or pretty much anything else that wants a GUC to control size of a shared memory allocation.
2009-01-02Remove comments that say restart is required for changing of KerberosMagnus Hagander
parameters.
2009-01-02Make it possible to change Kerberos/GSSAPI parameters without restartingMagnus Hagander
the postmaster. They are only used in backend processes, so it's just a matter of re-labeling the GUCs.
2009-01-02write_nondefault_variables must take care to write custom_variable_classesTom Lane
first; otherwise backends reading the file might reject values of custom variables. Per experimentation with auto_explain.
2009-01-02Tweak guc.c to allow underscores in the names of custom variable classes,Tom Lane
and change auto_explain's custom GUC variables to be named auto_explain.xxx not just explain.xxx. Per discussion in connection with the pg_stat_statements patch, it seems like a good idea to have the convention that custom variable classes are named the same as their defining module. Committing separately since this should happen regardless of what happens with pg_stat_statements itself.
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-30Fix oversight in ALTER TABLE ENABLE/DISABLE RULE patch: the new enabledTom Lane
field needs to be included in equalRuleLocks() comparisons, else updates will fail to propagate into relcache entries when they have positive reference count (ie someone is using the relcache entry). Per report from Alex Hunsaker.
2008-12-28Support window functions a la SQL:2008.Tom Lane
Hitoshi Harada, with some kibitzing from Heikki and Tom.
2008-12-27Make a couple of small changes to the tuplestore API, for the benefit of theTom Lane
upcoming window-functions patch. First, tuplestore_trim is now an exported function that must be explicitly invoked by callers at appropriate times, rather than something that tuplestore tries to do behind the scenes. Second, a read pointer that is marked as allowing backward scan no longer prevents truncation. This means that a read pointer marked as having BACKWARD but not REWIND capability can only safely read backwards as far as the oldest other read pointer. (The expected use pattern for this involves having another read pointer that serves as the truncation fencepost.)
2008-12-24Change the name of dtrace wal tracepoints:Bruce Momjian
TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY Robert Lor
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-17The attached patch contains a couple of fixes in the existing probes andBruce Momjian
includes a few new ones. - Fixed compilation errors on OS X for probes that use typedefs - Fixed a number of probes to pass ForkNumber per the relation forks patch - The new probes are those that were taken out from the previous submitted patch and required simple fixes. Will submit the other probes that may require more discussion in a separate patch. Robert Lor
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-13Increase the default value of default_statistics_target from 10 to 100,Tom Lane
and its maximum value from 1000 to 10000. ALTER TABLE SET STATISTICS similarly now allows a value up to 10000. Per discussion.
2008-12-13Remove pg_plan_queries()'s now-useless needSnapshot parameter. It's uselessTom Lane
in 8.3, too, but I'm not back-patching this change since it would break any extension modules that might be calling that function.
2008-12-13Fix failure to ensure that a snapshot is available to datatype input functionsTom Lane
when they are invoked by the parser. We had been setting up a snapshot at plan time but really it needs to be done earlier, before parse analysis. Per report from Dmitry Koterov. Also fix two related problems discovered while poking at this one: exec_bind_message called datatype input functions without establishing a snapshot, and SET CONSTRAINTS IMMEDIATE could call trigger functions without establishing a snapshot. Backpatch to 8.2. The underlying problem goes much further back, but it is masked in 8.1 and before because we didn't attempt to invoke domain check constraints within datatype input. It would only be exposed if a C-language datatype input function used the snapshot; which evidently none do, or we'd have heard complaints sooner. Since this code has changed a lot over time, a back-patch is hardly risk-free, and so I'm disinclined to patch further than absolutely necessary.
2008-12-11Append major version number and for libraries soname major version numberPeter Eisentraut
to the gettext domain name, to simplify parallel installations. Also, rename set_text_domain() to pg_bindtextdomain(), because that is what it does.
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-04Fix a couple of snapshot management bugs in the new ResourceOwner world:Alvaro Herrera
non-writable large objects need to have their snapshots registered on the transaction resowner, not the current portal's, because it must persist until the large object is closed (which the portal does not). Also, ensure that the serializable snapshot is recorded by the transaction resource owner too, even when a subtransaction has changed the current resource owner before serializable is taken. Per bug reports from Pavan Deolasee.
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.