aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
...
* 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...
* Fix patternsel() and callers to do the right thing for NOT LIKE and the otherTom Lane2007-11-07
| | | | | | | | | | | | | | negated-match operators. patternsel had been using the supplied operator as though it were a positive-match operator, and thus obtaining a wrong result, which was even more wrong after the caller subtracted it from 1. Seems cleanest to give patternsel an explicit "negate" argument so that it knows what's going on. Also install the same factorization scheme for pattern join selectivity estimators; even though they are just stubs at the moment, this may keep someone from making the same type of mistake when they get filled out. Per report from Greg Mullane. Backpatch to 8.2 --- previous releases do not show the problem because patternsel() doesn't actually use the operator directly.
* Fixed two parser bugs.Michael Meskes2007-11-06
|
* - Add check of already changed page while replay WAL. This touches onlyTeodor Sigaev2007-10-29
| | | | | | | | | | | | | ginRedoInsert(), because other ginRedo* functions rewrite whole page or make changes which could be applied several times without consistent's loss - Remove check of identifying of corresponding split record: it's possible that replaying of WAL starts after actual page split, but before removing of that split from incomplete splits list. In this case, that check cause FATAL error. Per stress test which reproduces bug reported by Craig McElroy <craig.mcelroy@contegix.com>
* Fix coredump during replay WAL after crash. Change entrySplitPage() to preventTeodor Sigaev2007-10-29
| | | | | | | | usage of any information from system catalog, because it could be called during replay of WAL. Per bug report from Craig McElroy <craig.mcelroy@contegix.com>. Patch doesn't change on-disk storage.
* Fix a couple of issues with pg_dump's handling of inheritance child tablesTom Lane2007-10-28
| | | | | | | | | | | | | | | | | | that have default expressions different from their parent. First, if the parent table's default expression has to be split out as a separate ALTER TABLE command, we need a dependency constraint to ensure that the child's command is given second. This is because the ALTER TABLE on the parent will propagate to the child. (We can't prevent that by using ONLY on the parent's command, since it's possible that other children exist that should receive the inherited default.) Second, if the child has a NULL default where the parent does not, we have to explicitly say DEFAULT NULL on the child in order for this state to be preserved after reload. (The latter actually doesn't work right because of a backend bug, but that is a separate issue.) Backpatch as far as 8.0. 7.x pg_dump has enough issues with altered tables (due to lack of dependency analysis) that trying to fix this one doesn't seem very productive.
* Change have_join_order_restriction() so that we do not force a clauseless joinTom Lane2007-10-26
| | | | | | | | | | | | | | | | if either of the input relations can legally be joined to any other rels using join clauses. This avoids uselessly (and expensively) considering a lot of really stupid join paths when there is a join restriction with a large footprint, that is, lots of relations inside its LHS or RHS. My patch of 15-Feb-2007 had been causing the code to consider joining *every* combination of rels inside such a group, which is exponentially bad :-(. With this behavior, clauseless bushy joins will be done if necessary, but they'll be put off as long as possible. Per report from Jakub Ouhrabka. Backpatch to 8.2. We might someday want to backpatch to 8.1 as well, but 8.1 does not have the problem for OUTER JOIN nests, only for IN-clauses, so it's not clear anyone's very likely to hit it in practice; and the current patch doesn't apply cleanly to 8.1.
* Ugly patch to make ALTER SEQUENCE OWNED BY not affect the currval() stateTom Lane2007-10-25
| | | | | | | | of the sequence. Since OWNED BY never existed before 8.2, this seems unlikely to create any compatibility issues. Other forms of ALTER SEQUENCE continue to do what they did before, namely update currval to match the sequence's actual last_val. That seems wrong on consideration, but we'll not change it in a minor release --- 8.3 will make that fix.
* Fix an error in make_outerjoininfo introduced by my patch of 30-Aug: the codeTom Lane2007-10-24
| | | | | | | | | | | | | neglected to test whether an outer join's join-condition actually refers to the lower outer join it is looking at. (The comment correctly described what was supposed to happen, but the code didn't do it...) This often resulted in adding an unnecessary constraint on the join order of the two outer joins, which was bad enough. However, it also seems to expose a performance problem in an older patch (from 15-Feb): once we've decided that there is a join ordering constraint, we will start trying clauseless joins between every combination of rels within the constraint, which pointlessly eats up lots of time and space if there are numerous rels below the outer join. That probably needs to be revisited :-(. Per gripe from Jakub Ouhrabka.
* Back-patch some plpython patches previously made only in HEAD: changes ofTom Lane2007-10-15
| | | | | | | | 3-Apr and 4-Apr to declare interface functions properly and eliminate casts, thereby fixing potential problems on 64-bit machines; and changes of 13-Jul to volatile-qualify some variables to suppress compiler warnings. Per discussion, we're only worrying about Python 2.5 in PG 8.2 and up, so no need to patch further back.
* Fix ALTER COLUMN TYPE to preserve the tablespace and reloptions of indexesTom Lane2007-10-13
| | | | | | | | | | it affects. The original coding neglected tablespace entirely (causing the indexes to move to the database's default tablespace) and for an index belonging to a UNIQUE or PRIMARY KEY constraint, it would actually try to assign the parent table's reloptions to the index :-(. Per bug #3672 and subsequent investigation. 8.0 and 8.1 did not have reloptions, but the tablespace bug is present.
* Ensure that the result of evaluating a function during constant-expressionTom Lane2007-10-11
| | | | | | | simplification gets detoasted before it is incorporated into a Const node. Otherwise, if an immutable function were to return a TOAST pointer (an unlikely case, but it can be made to happen), we would end up with a plan that depends on the continued existence of the out-of-line toast datum.