aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* Change hashscan.c to keep its list of active hash index scans inTom Lane2008-03-07
| | | | | | | | | | | | | TopMemoryContext, rather than scattered through executor per-query contexts. This poses no danger of memory leak since the ResourceOwner mechanism guarantees release of no-longer-needed items. It is needed because the per-query context might already be released by the time we try to clean up the hash scan list. Report by ykhuang, diagnosis by Heikki. Back-patch to 8.0, where the ResourceOwner-based cleanup was introduced. The given test case does not fail before 8.2, probably because we rearranged transaction abort processing somehow; but this coding is undoubtedly risky so I'll patch 8.0 and 8.1 anyway.
* Add support for dlopen on recent NetBSD/MIPS, per Rémi Zara.Alvaro Herrera2008-03-05
|
* In PrepareToInvalidateCacheTuple, don't force initialization of catalogTom Lane2008-03-05
| | | | | | | | | | caches that we don't actually need to touch. This saves some trivial number of cycles and avoids certain cases of deadlock when doing concurrent VACUUM FULL on system catalogs. Per report from Gavin Roy. Backpatch to 8.2. In earlier versions, CatalogCacheInitializeCache didn't lock the relation so there's no deadlock risk (though that certainly had plenty of risks of its own).
* Fix PREPARE TRANSACTION to reject the case where the transaction has dropped aTom Lane2008-03-04
| | | | | | | temporary table; we can't support that because there's no way to clean up the source backend's internal state if the eventual COMMIT PREPARED is done by another backend. This was checked correctly in 8.1 but I broke it in 8.2 :-(. Patch by Heikki Linnakangas, original trouble report by John Smith.
* Venezuela Time now means UTC-4:30, not UTC-4:00. Adjust our treatmentTom Lane2008-03-02
| | | | of "VET" accordingly. Per bug #3997 from Aaron Mizrachi.
* Don't call AddUserToDacl on CygwinAndrew Dunstan2008-02-29
|
* Fix handling of restricted processes for Windows Vista (mainly),Magnus Hagander2008-02-29
| | | | | | | | | by explicitly adding back the user to the DACL of the new process. This fixes the failure case when executing as the Administrator user, which had no permissions left at all after we dropped the Administrators group. Dave Page with some modifications from me
* Fix several memory leaks when rescanning SRFs. Arrange for an SRF'sNeil Conway2008-02-29
| | | | | | | | | | | | | | | | | | "multi_call_ctx" to be a distinct sub-context of the EState's per-query context, and delete the multi_call_ctx as soon as the SRF finishes execution. This avoids leaking SRF memory until the end of the current query, which is particularly egregious when the SRF is scanned multiple times. This change also fixes a leak of the fields of the AttInMetadata struct in shutdown_MultiFuncCall(). Also fix a leak of the SRF result TupleDesc when rescanning a FunctionScan node. The TupleDesc is allocated in the per-query context for every call to ExecMakeTableFunctionResult(), so we should free it after calling that function. Since the SRF might choose to return a non-expendable TupleDesc, we only free the TupleDesc if it is not being reference-counted. Backpatch to 8.3 and 8.2 stable branches.
* If RelationBuildDesc() fails to open a critical system index, PANIC withTom Lane2008-02-27
| | | | | a relevant error message instead of just dumping core. Odd that nobody reported this before Darren Reed.
* Fix uninstall target.Peter Eisentraut2008-02-26
|
* Fix datetime input to behave correctly for Feb 29 in years BC.Tom Lane2008-02-25
| | | | | | | | | | | | | | | | | | | Formerly, DecodeDate attempted to verify the day-of-the-month exactly, but it was under the misapprehension that it would know whether we were looking at a BC year or not. In reality this check can't be made until the calling function (eg DecodeDateTime) has processed all the fields. So, split the BC adjustment and validity checks out into a new function ValidateDate that is called only after processing all the fields. In passing, this patch makes DecodeTimeOnly work for BC inputs, which it never did before. (The historical veracity of all this is nonexistent, of course, but if we're going to say we support proleptic Gregorian calendar then we should do it correctly. In any case the unpatched code is broken because it could emit dates that it would then reject on re-inputting.) Per report from Bernd Helmle. Back-patch as far as 8.0; in 7.x we were not using our own calendar support and so this seems a bit too risky to put into 7.4.
* Avoid trying to print a NULL char pointer in --describe-config. On someTom Lane2008-02-23
| | | | platforms this works, but on some it crashes. Zdenek Kotala
* Fix mistakes in pg_ctl's code for "start -w" that tries to cope withTom Lane2008-02-20
| | | | | | | | | | non-default settings for the postmaster's port number. The code to parse command line options and postgresql.conf entries wasn't quite right about whitespace or quotes, and it was coded in a not-very-readable way too. Per bug #3969 from Itagaki Takahiro, though this is more extensive than his proposed patch (which fixed only the whitespace problem). This code has been broken since it was put in in 8.0, so patch all the way back.
* Put a CHECK_FOR_INTERRUPTS call into the loops that try to find a unique newTom Lane2008-02-20
| | | | | | | | | | OID or new relfilenode. If the existing OIDs are sufficiently densely populated, this could take a long time (perhaps even be an infinite loop), so it seems wise to allow the system to respond to a cancel interrupt here. Per a gripe from Jacky Leng. Backpatch as far as 8.1. Older versions just fail on OID collision, instead of looping.
* EXECUTE can return NOT FOUND so it should be checked here too.Michael Meskes2008-02-14
|
* Added SQLSTATE macro closing bug #3961.Michael Meskes2008-02-14
|
* Update timezone mapping for Windows with new timezones addedMagnus Hagander2008-02-11
| | | | | in windows servicepacks. Fix timezone mapping for "Mexico 2"
* Repair VACUUM FULL bug introduced by HOT patch: the original way ofTom Lane2008-02-11
| | | | | | | | | | | | | | | | | | | calculating a page's initial free space was fine, and should not have been "improved" by letting PageGetHeapFreeSpace do it. VACUUM FULL is going to reclaim LP_DEAD line pointers later, so there is no need for a guard against the page being too full of line pointers, and having one risks rejecting pages that are perfectly good move destinations. This also exposed a second bug, which is that the empty_end_pages logic assumed that any page with no live tuples would get entered into the fraged_pages list automatically (by virtue of having more free space than the threshold in the do_frag calculation). This assumption certainly seems risky when a low fillfactor has been chosen, and even without tunable fillfactor I think it could conceivably fail on a page with many unused line pointers. So fix the code to force do_frag true when notup is true, and patch this part of the fix all the way back. Per report from Tomas Szepe.
* Some variants of ALTER OWNER tried to make the "object" field of theTom Lane2008-02-07
| | | | | | | | | | statement be a list of bare C strings, rather than String nodes, which is what they need to be for copyfuncs/equalfuncs to work. Fortunately these node types never go out to disk (if they did, we'd likely have noticed the problem sooner), so we can just fix it without creating a need for initdb. This bug has been there since 8.0, but 8.3 exposes it in a more common code path (Parse messages) than prior releases did. Per bug #3940 from Vladimir Kokovic.
* Fix WaitOnLock() to ensure that the process's "waiting" flag is reset afterTom Lane2008-02-02
| | | | | | | | | | | | | erroring out of a wait. We can use a PG_TRY block for this, but add a comment explaining why it'd be a bad idea to use it for any other state cleanup. Back-patch to 8.2. Prior releases had the same issue, but only with respect to the process title, which is likely to get reset almost immediately anyway after the transaction aborts, so it seems not worth changing them. In 8.2 and HEAD, the pg_stat_activity "waiting" flag could remain set incorrectly for a long time. Per report from Gurjeet Singh.
* Add pid to the pgident event name on win32.Magnus Hagander2008-01-31
| | | | | | | | | Should fix a problem where two clusters are running under two different service accounts and get colliding names, causing only the first cluster to contain the pgident event description. Per report from Stephen Denne.
* Prevent integer overflow within the integer-datetimes version ofTom Lane2008-01-23
| | | | | | | | TimestampTzPlusMilliseconds. An integer argument of more than INT_MAX/1000 milliseconds (ie, about 35 minutes) would provoke a wrong result, resulting in incorrect enforcement of statement_timestamp values larger than that. Bug was introduced in my rewrite of 2006-06-20, which fixed some other overflow risks, but missed this one :-( Per report from Elein.
* Work around for perl 5.10 bug - fix due to perl hacker Simon Cozens.Andrew Dunstan2008-01-22
|
* Backpatch my fix of rev 1.48 to avoid a division-by-zero error in theAlvaro Herrera2008-01-17
| | | | cost-limit vacuum code. Per trouble report from Joshua Drake.
* Fix subselect.c to avoid assuming that a SubLink's testexpr references eachTom Lane2008-01-17
| | | | | | | | | | subquery output column exactly once left-to-right. Although this is the case in the original parser output, it might not be so after rewriting and constant-folding, as illustrated by bug #3882 from Jan Mate. Instead scan the subquery's target list to obtain needed per-column information; this is duplicative of what the parser did, but only a couple dozen lines need be copied, and we can clean up a couple of notational uglinesses. Bug was introduced in 8.2 as part of revision of SubLink representation.
* Fix an ancient oversight in libpq's handling of V3-protocol COPY OUT mode:Tom Lane2008-01-14
| | | | | | | we need to be able to swallow NOTICE messages, and potentially also ParameterStatus messages (although the latter would be a bit weird), without exiting COPY OUT state. Fix it, and adjust the protocol documentation to emphasize the need for this. Per off-list report from Alexander Galler.
* Fix logical errors in constraint exclusion: we cannot assume that a CHECKTom Lane2008-01-12
| | | | | | | | | | | | | | | constraint yields TRUE for every row of its table, only that it does not yield FALSE (a NULL result isn't disallowed). This breaks a couple of implications that would be true in two-valued logic. I had put in one such mistake in an 8.2.5 patch: foo IS NULL doesn't refute a strict operator on foo. But there was another in the original 8.2 release: NOT foo doesn't refute an expression whose truth would imply the truth of foo. Per report from Rajesh Kumar Mallah. To preserve the ability to do constraint exclusion with one partition holding NULL values, extend relation_excluded_by_constraints() to check for attnotnull flags, and add col IS NOT NULL expressions to the set of constraints we hope to refute.
* Fix a conceptual error in my patch of 2007-10-26 that avoided consideringTom Lane2008-01-11
| | | | | | | | | | | | clauseless joins of relations that have unexploited join clauses. Rather than looking at every other base relation in the query, the correct thing is to examine the other relations in the "initial_rels" list of the current make_rel_from_joinlist() invocation, because those are what we actually have the ability to join against. This might be a subset of the whole query in cases where join_collapse_limit or from_collapse_limit or full joins have prevented merging the whole query into a single join problem. This is a bit untidy because we have to pass those rels down through a new PlannerInfo field, but it's necessary. Per bug #3865 from Oleg Kharin.
* Fix a bug in 8.2.x that was exposed while investigating Kevin Grittner'sTom Lane2008-01-09
| | | | | | | | | | | | | | report of poor planning in 8.3: it's unsafe to push a constant across an outer join when the outer-join condition is delayed by lower outer joins, unless we recheck the outer-join condition at the upper outer join. 8.2.x doesn't really have the ability to tell whether this is the case or not, but fortunately it doesn't matter --- it seems most desirable to keep the join condition whether it's entirely redundant or not. However, it's usually mostly redundant, so force its selectivity to 1.0. It might be a good idea to back-patch this into 8.1 as well, but I'll refrain until/unless there's evidence that 8.1 actually fails on any cases that this would fix.
* A long time ago, Peter pointed out that ruleutils.c didn't dump simpleTom Lane2008-01-06
| | | | | | | | | | | | | | | | constant ORDER/GROUP BY entries properly: http://archives.postgresql.org/pgsql-hackers/2001-04/msg00457.php The original solution to that was in fact no good, as demonstrated by today's report from Martin Pitt: http://archives.postgresql.org/pgsql-bugs/2008-01/msg00027.php We can't use the column-number-reference format for a constant that is a resjunk targetlist entry, a case that was unfortunately not thought of in the original discussion. What we can do instead (which did not work at the time, but does work in 7.3 and up) is to emit the constant with explicit ::typename decoration, even if it otherwise wouldn't need it. This is sufficient to keep the parser from thinking it's a column number reference, and indeed is probably what the user must have done to get such a thing into the querytree in the first place.
* Stamp release 8.2.6.REL8_2_6Tom Lane2008-01-03
| | | | Security: CVE-2007-4769, CVE-2007-4772, CVE-2007-6067, CVE-2007-6600, CVE-2007-6601
* Make standard maintenance operations (including VACUUM, ANALYZE, REINDEX,Tom Lane2008-01-03
| | | | | | | | | | | | | | | | | | | and CLUSTER) execute as the table owner rather than the calling user, using the same privilege-switching mechanism already used for SECURITY DEFINER functions. The purpose of this change is to ensure that user-defined functions used in index definitions cannot acquire the privileges of a superuser account that is performing routine maintenance. While a function used in an index is supposed to be IMMUTABLE and thus not able to do anything very interesting, there are several easy ways around that restriction; and even if we could plug them all, there would remain a risk of reading sensitive information and broadcasting it through a covert channel such as CPU usage. To prevent bypassing this security measure, execution of SET SESSION AUTHORIZATION and SET ROLE is now forbidden within a SECURITY DEFINER context. Thanks to Itagaki Takahiro for reporting this vulnerability. Security: CVE-2007-6600
* Fix assorted security-grade bugs in the regex engine. All of these problemsTom Lane2008-01-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | are shared with Tcl, since it's their code to begin with, and the patches have been copied from Tcl 8.5.0. Problems: CVE-2007-4769: Inadequate check on the range of backref numbers allows crash due to out-of-bounds read. CVE-2007-4772: Infinite loop in regex optimizer for pattern '($|^)*'. CVE-2007-6067: Very slow optimizer cleanup for regex with a large NFA representation, as well as crash if we encounter an out-of-memory condition during NFA construction. Part of the response to CVE-2007-6067 is to put a limit on the number of states in the NFA representation of a regex. This seems needed even though the within-the-code problems have been corrected, since otherwise the code could try to use very large amounts of memory for a suitably-crafted regex, leading to potential DOS by driving the system into swap, activating a kernel OOM killer, etc. Although there are certainly plenty of ways to drive the system into effective DOS with poorly-written SQL queries, these problems seem worth treating as security issues because many applications might accept regex search patterns from untrustworthy sources. Thanks to Will Drewry of Google for reporting these problems. Patches by Will Drewry and Tom Lane. Security: CVE-2007-4769, CVE-2007-4772, CVE-2007-6067
* Insert ARST into the list of known timezone abbreviations.Tom Lane2008-01-02
|
* Fix plpython's overoptimistic caching of information about the rowtype ofTom Lane2008-01-02
| | | | | | | | | | | a trigger's target table. The rowtype could change from one call to the next, so cope in such cases, while avoiding doing repetitive catalog lookups. Per bug #3847 from Mark Reid. Backpatch to 8.2.x. Likely this fix should go further back, but I can't test it because I no longer have a machine with a pre-2.5 Python installation. (Maybe we should rethink that idea about not supporting Python 2.5 in the older branches.)
* Update time zone data files to tzdata release 2007k.Tom Lane2008-01-01
|
* Improve a number of elog messages for not-supposed-to-happen cases in btrees,Tom Lane2007-12-31
| | | | | | | | | since these seem to happen after all in corrupted indexes. Make sure we supply the index name in all cases, and provide relevant block numbers where available. Also consistently identify the index name as such. Back-patch to 8.2, in hopes that this might help Mason Hale figure out his problem.
* Make path_recv() and poly_recv() reject paths/polygons containing no points.Tom Lane2007-12-18
| | | | | | | | The zero-point case is sensible so far as the data structure is concerned, so maybe we ought to allow it sometime; but right now the textual input routines for these types don't allow it, and it seems that not all the functions for the types are prepared to cope. Report and patch by Merlin Moncure.
* Suppress compiler warnings in recent plperl patch. Avoid uselessly expensiveTom Lane2007-12-01
| | | | lookup of the well-known OID of textout().
* Workaround for perl problem where evaluating UTF8 regexes can causeAndrew Dunstan2007-12-01
| | | | | | implicit loading of modules, thereby breaking Safe rules. We compile and call a tiny perl function on trusted interpreter init, after which the problem does not occur.
* Add win32error.c to libpq, needed to resolve _dosmaperr.Magnus Hagander2007-11-30
|
* Use _dosmaperr() to deal with errors opening files in pgwin32_open().Magnus Hagander2007-11-30
| | | | Per complaint from Alvaro and subsequent discussion.
* Back-patch mingw configure-check for gettimeofday so that 8.2 canMagnus Hagander2007-11-29
| | | | be built with current versions of mingw.
* Fix buggy usage of vsnprintf in PL/Python by removing it altogether, insteadAlvaro Herrera2007-11-23
| | | | | relying on stringinfo.c. This fixes a problem reported by Marko Kreen, but I didn't use his patch, per subsequent discussion.
* Prevent Perl from introducing a possibly-incompatible definition of typeTom Lane2007-11-22
| | | | | | | | | | "bool" into plperl.c. This has always been a hazard since Perl allows a platform-specific choice to define bool as int rather than char, but evidently this didn't happen on any platform we support ... until OS X 10.5. Per report from Brandon Maust. Back-patch as far as 8.0 --- a bit arbitrary, but it seems unlikely anyone will be trying to port 7.x onto new platforms.
* GIN index build's allocatedMemory counter needs to be long, not uint32.Tom Lane2007-11-16
| | | | | | | | | Else, in a 64-bit machine with maintenance_work_mem set to above 4Gb, the counter overflows and we never recognize having reached the maintenance_work_mem limit. I believe this explains out-of-memory failure recently reported by Sean Davis. This is a bug, so backpatch to 8.2.
* Update timezone data files to release 2007i of the zic database.Tom Lane2007-11-15
|
* Second pass at improving LIKE/regex estimation in non-C locales. It turnsTom Lane2007-11-09
| | | | | | | | | | out that it's actually quite likely that a string that is an extension of the given prefix will sort as larger than the "greater" string our previous code created. To provide some defense against that, do the comparisons against a modified string instead of just the bare prefix. We tack on "Z", "z", "y", or "9", whichever is seen as largest in the current locale. Testing suggests that this is sufficient at least for cases involving ASCII data.
* If an index depends on no columns of its table, give it a dependency on theTom Lane2007-11-08
| | | | | | | | | whole table instead, to ensure that it goes away when the table is dropped. Per bug #3723 from Sam Mason. Backpatch as far as 7.4; AFAICT 7.3 does not have the issue, because it doesn't have general-purpose expression indexes and so there must be at least one column referenced by an index.
* Improve the performance of LIKE/regex estimation in non-C locales, by makingTom Lane2007-11-07
| | | | | | | | | | | | | | | | make_greater_string() try harder to generate a string that's actually greater than its input string. Before we just assumed that making a string that was memcmp-greater was enough, but it is easy to generate examples where this is not so when the locale is not C. Instead, loop until the relevant comparison function agrees that the generated string is greater than the input. Unfortunately this is probably not enough to guarantee that the generated string is greater than all extensions of the input, so we cannot relax the restriction to C locale for the LIKE/regex index optimization. But it should at least improve the odds of getting a useful selectivity estimate in prefix_selectivity(). Per example from Guillaume Smet. Backpatch to 8.1, mainly because that's what the complainant is using...