summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2009-04-09Update time zone data files to tzdata release 2009e: DST law changes inTom Lane
Argentina/San_Luis, Cuba, Jordan (historical correction only), Morocco, Palestine, Syria, Tunisia.
2009-04-06Fix 'all at one page bug' in picksplit method of R-tree emulation. Add defenseTeodor Sigaev
from buggy user-defined picksplit to GiST.
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-03Use (unsigned char) cast in argument of pg_tolower(). Maybe it works onTom Lane
Windows without that, but we shouldn't put bad examples where people might copy them. Also, reformat slightly to improve the odds that pgindent won't go nuts on this.
2009-04-03Make directory name comparisons on Win32 case insensitive.Magnus Hagander
This method will not catch all different ways since the locale handling in NTFS doesn't provide an easy way to do that, but it will hopefully solve the most common cases causing startup problems when the backend is found in the system PATH. Attempts to fix bug #4694.
2009-04-02Fix GUC's reports of assign_hook failure to always include the parameter valueTom Lane
we failed to assign, even in "can't happen" cases. Motivated by wondering what's going on in a recent trouble report where "failed to commit" did happen.
2009-04-02plpgsql's exec_simple_cast_value() mistakenly supposed that it could bypassTom Lane
casting effort whenever the input value was NULL. However this prevents application of not-null domain constraints in the cases that use this function, as illustrated in bug #4741. Since this function isn't meant for use in performance-critical paths anyway, this certainly seems like another case of "premature optimization is the root of all evil". Back-patch as far as 8.2; older versions made no effort to enforce domain constraints here anyway.
2009-04-01Improve pg_dump's query for retrieving BLOB comments to be more efficientTom Lane
when there are many blobs and not so many comments. Tamas Vincze
2009-03-31Don't crash initdb when we fail to get the current username.Magnus Hagander
Give an error message and exit instead, like we do elsewhere... Per report from Wez Furlong and Robert Treat.
2009-03-31Fix a rare race condition when commit_siblings > 0 and a transaction commitsHeikki Linnakangas
at the same instant as a new backend is spawned. Since CountActiveBackends() doesn't hold ProcArrayLock, it needs to be prepared for the case that a pointer at the end of the proc array is still NULL even though numProcs says it should be valid, since it doesn't hold ProcArrayLock. Backpatch to 8.1. 8.0 and earlier had this right, but it was broken in the split of PGPROC and sinval shared memory arrays. Per report and proposal by Marko Kreen.
2009-03-30Fix an oversight in the support for storing/retrieving "minimal tuples" inTom Lane
TupleTableSlots. We have functions for retrieving a minimal tuple from a slot after storing a regular tuple in it, or vice versa; but these were implemented by converting the internal storage from one format to the other. The problem with that is it invalidates any pass-by-reference Datums that were already fetched from the slot, since they'll be pointing into the just-freed version of the tuple. The known problem cases involve fetching both a whole-row variable and a pass-by-reference value from a slot that is fed from a tuplestore or tuplesort object. The added regression tests illustrate some simple cases, but there may be other failure scenarios traceable to the same bug. Note that the added tests probably only fail on unpatched code if it's built with --enable-cassert; otherwise the bug leads to fetching from freed memory, which will not have been overwritten without additional conditions. Fix by allowing a slot to contain both formats simultaneously; which turns out not to complicate the logic much at all, if anything it seems less contorted than before. Back-patch to 8.2, where minimal tuples were introduced.
2009-03-27Fix tab completion of ANALYZE VERBOSE <tab>. It was previously confusedHeikki Linnakangas
with EXPLAIN ANALYZE VERBOSE. Greg Sabino Mullane, reformatted by myself. Backpatch to 8.1, where the bug was introduced.
2009-03-24Install a search tree depth limit in GIN bulk-insert operations, to preventTom Lane
them from degrading badly when the input is sorted or nearly so. In this scenario the tree is unbalanced to the point of becoming a mere linked list, so insertions become O(N^2). The easiest and most safely back-patchable solution is to stop growing the tree sooner, ie limit the growth of N. We might later consider a rebalancing tree algorithm, but it's not clear that the benefit would be worth the cost and complexity. Per report from Sergey Burladyan and an earlier complaint from Heikki. Back-patch to 8.2; older versions didn't have GIN indexes.
2009-03-18Fix Windows-specific race condition in syslogger. This could've beenHeikki Linnakangas
the cause of the "could not write to log file: Bad file descriptor" errors reported at http://archives.postgresql.org//pgsql-general/2008-06/msg00193.php Backpatch to 8.3, the race condition was introduced by the CSV logging patch. Analysis and patch by Gurjeet Singh.
2009-03-13tag 8.3.7REL8_3_7Marc G. Fournier
2009-03-12Translation updatesPeter Eisentraut
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-11Remove pg_trace.h inclusion from c.h and add it to the .c files that need it.Alvaro Herrera
Only needed in 8.3 because it's already this way in HEAD, and older branches did not support DTrace. This allows external modules to compile on Linux machines where SystemTap support was recently added, when the required SystemTap headers are not present on the build machine. Approach suggested by Tom, after a RPM build trouble report by Devrim Gunduz.
2009-03-10Fix set_subquery_pathlist() to copy the RTE's subquery before it gets mangledTom Lane
by the planning process. This prevents the "failed to locate grouping columns" error recently reported by Dickson Guedes. That happens because planning replaces SubLinks by SubPlans in the subquery's targetlist, and exprTypmod() is smarter about the former than the latter, causing the apparent type of the subquery's output columns to change. This seems to be a deficiency we should fix in exprTypmod(), but that will be a much more invasive patch with possible side-effects elsewhere, so I'll do that only in HEAD. Back-patch to 8.3. Arguably the lack of a copying step is broken/dangerous all the way back, but in the absence of known problems I'll refrain from making the older branches pay the extra cost. (The reason this particular symptom didn't appear before is that exprTypmod() wasn't smart about SubLinks either, until 8.3.)
2009-03-10Prevent recursion during parse of email-like string with multiple '@'.Teodor Sigaev
Patch by Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
2009-03-05Add MUST (Mauritius Island Summer Time) to the list of known abbreviations.Heikki Linnakangas
Mauritius began using DST in the summer 2008-2009; the Olson library has been updated already. Xavier Bugaud
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-03Ooops ... fix some confusion between gettext() and _() in my previous patch.Tom Lane
This has moved around in past releases, so just copying-and-pasting from HEAD didn't work as intended.
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-28Don't mangle xml and xpath unless xml is not in fact a well-formed document, ↵Andrew Dunstan
in xpath(). If mangling xpath, make a saner attempt where xpath expression does not begin with '/'.
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-27In CREATE CONVERSION, test that the given function is a valid conversionHeikki Linnakangas
function for the specified source and destination encodings. We do that by calling the function with an empty string. If it can't perform the requested conversion, it will throw an error. Backport to 7.4 - 8.3. Per bug report #4680 by Denis Afonin.
2009-02-27Set isnull for errm and sqlstate local variables when they're free'd. BecauseHeikki Linnakangas
they are out of scope for any code after that anyway, leaving isnull true should be harmless. However, PL/pgSQL Debugger doesn't seem to care about the scoping and crashed, per report by Robert Walker (bug #4635). And it's good to be tidy for debugging purposes too. Fix in 8.3, 8.2 and 8.1 branches, CVS HEAD was fixed earlier already. Analysis and fix by Ashesh Vashi and Dave Page.
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-24Repair a longstanding bug in CLUSTER and the rewriting variants of ALTERTom Lane
TABLE: if the command is executed by someone other than the table owner (eg, a superuser) and the table has a toast table, the toast table's pg_type row ends up with the wrong typowner, ie, the command issuer not the table owner. This is quite harmless for most purposes, since no interesting permissions checks consult the pg_type row. However, it could lead to unexpected failures if one later tries to drop the role that issued the command (in 8.1 or 8.2), or strange warnings from pg_dump afterwards (in 8.3 and up, which will allow the DROP ROLE because we don't create a "redundant" owner dependency for table rowtypes). Problem identified by Cott Lang. Back-patch to 8.1. The problem is actually far older --- the CLUSTER variant can be demonstrated in 7.0 --- but it's mostly cosmetic before 8.1 because we didn't track ownership dependencies before 8.1. Also, fixing it before 8.1 would require changing the call signature of heap_create_with_catalog(), which seems to carry a nontrivial risk of breaking add-on modules.
2009-02-15Loop calling CallNamedPipe() several times in case it fails,Magnus Hagander
since it can be transient failures, causing kill() to not properly send signals. Original patch from Steve Marshall, modified by me.
2009-02-13Fix UNLISTEN to fall out quickly if the current backend has never executedTom Lane
any LISTEN command. This is more important than it used to be because DISCARD ALL invokes UNLISTEN. Connection-pooled applications making heavy use of DISCARD ALL were seeing significant contention for pg_listener, as reported by Matteo Beccati. It seems unlikely that clients using LISTEN would use pooled connections, so this simple tweak seems sufficient, especially since the pg_listener implementation is slated to go away soon anyway. Back-patch to 8.3, where DISCARD ALL was introduced.
2009-02-02Fix plpgsql to not treat INSERT INTO as an INTO-variables clause anywhereREL8_3_6Tom Lane
in the string, not just at the start. Per bug #4629 from Martin Blazek. Back-patch to 8.2; prior versions don't have the problem, at least not in the reported case, because they don't try to recognize INTO in non-SELECT statements. (IOW, this is really fallout from the RETURNING patch.)
2009-01-30Defend against null input in analyze_requires_snapshot(), per reportTom Lane
from Rushabh Lathia. Back-patch of patch of 2009-01-08. This is necessary in 8.3, as reported by Bjorn Munch. It's not currently necessary in 8.2, AFAICS, but seems best to include it there too.
2009-01-30tag for 8.3.6Marc G. Fournier
2009-01-29Translation updatesPeter Eisentraut
2009-01-29Update time zone data files to tzdata release 2009a: introduces Asia/KathmanduTom Lane
as the preferred spelling of that zone name, corrects historical DST information for Switzerland and Cuba.
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-29Fix incorrect dereferencing of char* to array's index.Teodor Sigaev
Per Tommy Gildseth <tommy.gildseth@usit.uio.no> report
2009-01-28Go over all OpenSSL return values and make sure we compare themMagnus Hagander
to the documented API value. The previous code got it right as it's implemented, but accepted too much/too little compared to the API documentation. Per comment from Zdenek Kotala.
2009-01-28Support running as a service on Windows 7, by not specifyingMagnus Hagander
the JOB_OBJECT_UILIMIT_HANDLES flag. Dave Page & Magnus Hagander
2009-01-18Fix a pg_dump output ordering problem introduced in 8.3 by the addition ofTom Lane
array types for composite types. Although pg_dump understood it wasn't supposed to dump these array types as separate objects, it must include them in the dependency ordering analysis, and it was improperly assigning them the same relatively-high sort priority as regular types. This resulted in effectively moving composite types and tables up to that same high priority, which broke any ordering requirements that weren't explicitly enforced by dependencies. In particular user-defined operator classes, which should come out before tables, failed to do so. Per report from Brendan Jurd. In passing, also fix an ill-considered decision to give text search objects the same sort priority as functions and operators --- the sort result looks a lot nicer if different object types are kept separate. The recent foreign-data patch had copied that decision, making the sort ordering even messier :-(
2009-01-15Fix URL generation in headline. Only tag lexeme will be replaced by space.Teodor Sigaev
Per http://archives.postgresql.org/pgsql-bugs/2008-12/msg00013.php
2009-01-15Fix generation of too long headline with ShortWords.Teodor Sigaev
Per http://archives.postgresql.org/pgsql-hackers/2008-09/msg01088.php
2009-01-14Remove broken Assertions that failed if a statement executed in PL/pgSQL isHeikki Linnakangas
rewritten into another kind of statement, for example if an INSERT is rewritten into an UPDATE. Back-patch to 8.3 and 8.2. For HEAD, Tom suggested inventing a new SPI_OK_REWRITTEN return code, but that's not a backportable solution. I'll do that as a separate patch, this patch will do as a stopgap measure for HEAD too in the meanwhile.
2009-01-13Throw an error when using -C and -1 at the same time in pg_restore.Magnus Hagander
It's not possible to do CREATE DATABASE inside a transaction, so previously we just got a server error instead. Backpatch to 8.2, which is where the -1 feature appeared.
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-06Fix logic in lazy vacuum to decide if it's worth trying to truncate the heap.Heikki Linnakangas
If the table was smaller than REL_TRUNCATE_FRACTION (= 16) pages, we always tried to acquire AccessExclusiveLock on it even if there was no empty pages at the end. Report by Simon Riggs. Back-patch all the way to 7.4.
2009-01-01Fix an oversight in my patch of a couple weeks ago that ensured a snapshotTom Lane
is available during datatype input in Bind message processing. I put the PopActiveSnapshot() or equivalent just before PortalDefineQuery, which is an unsafe spot for it (in 8.3 and later) because we are carrying a plancache refcount that hasn't yet been assigned to the portal. Any error thrown there would result in leaking the refcount. It's not exactly likely that PopActiveSnapshot would throw an elog, perhaps, but it could happen. Reorder the code and add another comment warning not to do that.