summaryrefslogtreecommitdiff
path: root/src/backend/utils
AgeCommit message (Collapse)Author
2009-03-27Add an errdetail explaining why we reject infinite dates and timestampsTom Lane
while converting to XML. Bernd Helmle
2009-03-27Fix possible failures when a tuplestore switches from in-memory to on-diskTom Lane
mode while callers hold pointers to in-memory tuples. I reported this for the case of nodeWindowAgg's primary scan tuple, but inspection of the code shows that all of the calls in nodeWindowAgg and nodeCtescan are at risk. For the moment, fix it with a rather brute-force approach of copying whenever one of the at-risk callers requests a tuple. Later we might think of some sort of reference-count approach to reduce tuple copying.
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-23More fixes for 8.4 DTrace probes. Remove useless BUFFER_HIT/BUFFER_MISSTom Lane
probes --- the BUFFER_READ_DONE probe provides the same information and more besides. Expand the LOCK_WAIT_START/DONE probe arguments so that there's actually some chance of telling what is being waited for. Update and clean up the documentation.
2009-03-22Add isExtend to the parameters of the buffer_read_start and buffer_read_doneTom Lane
DTrace probes, so that ordinary reads can be distinguished from relation extension operations. Move buffer_read_start probe to before the smgrnblocks() call that's needed in the isExtend case, since really that step should be charged as part of the time needed for the extension operation. (This makes it slightly harder to match the read_start with the associated read_done, since now you can't match them on blockNumber, but it should still be possible since isExtend operations on the same relation can never be interleaved.) Per recent discussion. In passing, add the page identity (forkNum/blockNum) to the parameters of the buffer_flush_start/buffer_flush_done probes, which were unaccountably lacking the info.
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-18Fix case of the just resurrected UCS_to_BIG5.pl script, and updateHeikki Linnakangas
Makefile to use it.
2009-03-18Add seven kanji characters defined in the Windows 950 codepage to ourHeikki Linnakangas
big5/win950 <-> UTF8 conversion tables. Per report by Roger Chang.
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-11Code review for dtrace probes added (so far) to 8.4. Adjust placement ofTom Lane
some bufmgr probes, take out redundant and memory-leak-inducing path arguments to smgr__md__read__done and smgr__md__write__done, fix bogus attempt to recalculate space used in sort__done, clean up formatting in places where I'm not sure pgindent will do a nice job by itself.
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-09Add summarization comment about visibility functions.Bruce Momjian
Add URL about the Halloween problem.
2009-03-09Revert pg_bind_textdomain_codeset to a existant-but-empty function whenAlvaro Herrera
ENABLE_NLS is not defined, for better compatibility of the backend with modules compiled the other way. Per note from Tom after my previous commit.
2009-03-08pg_bind_textdomain_codeset must exist only on ENABLE_NLS.Alvaro Herrera
2009-03-08On Windows, call bind_textdomain_codeset on domains other than the default one,Alvaro Herrera
too, so that the codeset is properly mapped on the newly added PL domains.
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-03-02When we are in error recursion trouble, arrange to suppress translation andTom Lane
encoding conversion of any elog/ereport message being sent to the frontend. This generalizes a patch that I put in last October, which suppressed translation of only specific messages known to be associated with recursive can't-translate-the-message behavior. As shown in bug #4680, we need a more general answer in order to have some hope of coping with broken encoding conversion setups. This approach seems a good deal less klugy anyway. Patch in all supported branches.
2009-03-02Fix usage of char2wchar/wchar2char. Changes:Teodor Sigaev
- pg_wchar and wchar_t could have different size, so char2wchar doesn't call pg_mb2wchar_with_len to prevent out-of-bound memory bug - make char2wchar/wchar2char symmetric, now they should not be called with C-locale because mbstowcs/wcstombs oftenly doesn't work correct with C-locale. - Text parser uses pg_mb2wchar_with_len directly in case of C-locale and multibyte encoding Per bug report by Hiroshi Inoue <inoue@tpf.co.jp> and following discussion. Backpatch up to 8.2 when multybyte support was implemented in tsearch.
2009-02-28Fix buffer allocations in encoding conversion routines so that they won'tTom Lane
fail on zero-length inputs. This isn't an issue in normal use because the conversion infrastructure skips calling the converters for empty strings. However a problem was created by yesterday's patch to check whether the right conversion function is supplied in CREATE CONVERSION. The most future-proof fix seems to be to make the converters safe for this corner case.
2009-02-28Reduce the maximum value of vacuum_cost_delay and autovacuum_vacuum_cost_delayTom Lane
to 100ms (from 1000). This still seems to be comfortably larger than the useful range of the parameter, and it should help discourage people from picking uselessly large values. Tweak the documentation to recommend small values, too. Per discussion of a couple weeks ago.
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-18Start background writer during archive recovery. Background writer now performsHeikki Linnakangas
its usual buffer cleaning duties during archive recovery, and it's responsible for performing restartpoints. This requires some changes in postmaster. When the startup process has done all the initialization and is ready to start WAL redo, it signals the postmaster to launch the background writer. The postmaster is signaled again when the point in recovery is reached where we know that the database is in consistent state. Postmaster isn't interested in that at the moment, but that's the point where we could let other backends in to perform read-only queries. The postmaster is signaled third time when the recovery has ended, so that postmaster knows that it's safe to start accepting connections. The startup process now traps SIGTERM, and performs a "clean" shutdown. If you do a fast shutdown during recovery, a shutdown restartpoint is performed, like a shutdown checkpoint, and postmaster kills the processes cleanly. You still have to continue the recovery at next startup, though. Currently, the background writer is only launched during archive recovery. We could launch it during crash recovery as well, but it seems better to keep that codepath as simple as possible, for the sake of robustness. And it couldn't do any restartpoints during crash recovery anyway, so it wouldn't be that useful. log_restartpoints is gone. Use log_checkpoints instead. This is yet to be documented. This whole operation is a pre-requisite for Hot Standby, but has some value of its own whether the hot standby patch makes 8.4 or not. Simon Riggs, with lots of modifications by me.
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-10Support for KOI8U encodingPeter Eisentraut
2009-02-10Remove the encoding *numbers* from the comments. They are useless, andPeter Eisentraut
make maintenance harder.
2009-02-10Add possibility to generate only some files, by passing command-linePeter Eisentraut
arguments.
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-29Replace argument-checking Asserts with regular test-and-elog checks in allTom Lane
encoding conversion functions. These are not can't-happen cases because it's possible to create a conversion with the wrong conversion function for the specified encoding pair. That would lead to an Assert crash in an Assert-enabled build, or incorrect conversion otherwise, neither of which is desirable. This would be a DOS issue if production databases were customarily built with asserts enabled, but fortunately that's not so. Per an observation by Heikki. Back-patch to all supported branches.
2009-01-27Silence compiler warnings in new win32 locale codeMagnus Hagander
when building on mingw. ITAGAKI Takahiro
2009-01-27Revert updatable viewsPeter Eisentraut
2009-01-26Allow extracting and parsing of reloptions from a bare pg_class tuple, andAlvaro Herrera
refactor the relcache code that used to do that. This allows other callers (particularly autovacuum) to do the same without necessarily having to open and lock a table.
2009-01-22Support column-level privileges, as required by SQL standard.Tom Lane
Stephen Frost, with help from KaiGai Kohei and others
2009-01-22Automatic view update rulesPeter Eisentraut
Bernd Helmle
2009-01-22Explicitly bind gettext to the correct encoding on Windows.Magnus Hagander
Original patch from Hiroshi Inoue.
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-21Make some strings translatable again that were accidentally removed inMagnus Hagander
earlier patch to fix "printf-arguments".
2009-01-19Use the new text domain names ("postgres-8.4" instead of "postgres")Magnus Hagander
Hiroshi Inoue
2009-01-16Add vacuum_freeze_table_age GUC option, to control when VACUUM shouldHeikki Linnakangas
ignore the visibility map and scan the whole table, to advance relfrozenxid.
2009-01-12Implement prefetching via posix_fadvise() for bitmap index scans. A newTom Lane
GUC variable effective_io_concurrency controls how many concurrent block prefetch requests will be issued. (The best way to handle this for plain index scans is still under debate, so that part is not applied yet --- tgl) Greg Stark
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.