summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2008-01-03Fix assorted security-grade bugs in the regex engine. All of these problemsTom Lane
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
2008-01-02Insert ARST into the list of known timezone abbreviations.Tom Lane
2008-01-02Fix plpython's overoptimistic caching of information about the rowtype ofTom Lane
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.)
2008-01-01Update time zone data files to tzdata release 2007k.Tom Lane
2007-12-31Improve a number of elog messages for not-supposed-to-happen cases in btrees,Tom Lane
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.
2007-12-18Make path_recv() and poly_recv() reject paths/polygons containing no points.Tom Lane
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.
2007-12-01Suppress compiler warnings in recent plperl patch. Avoid uselessly expensiveTom Lane
lookup of the well-known OID of textout().
2007-12-01Workaround for perl problem where evaluating UTF8 regexes can causeAndrew Dunstan
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.
2007-11-30Add win32error.c to libpq, needed to resolve _dosmaperr.Magnus Hagander
2007-11-30Use _dosmaperr() to deal with errors opening files in pgwin32_open().Magnus Hagander
Per complaint from Alvaro and subsequent discussion.
2007-11-29Back-patch mingw configure-check for gettimeofday so that 8.2 canMagnus Hagander
be built with current versions of mingw.
2007-11-23Fix buggy usage of vsnprintf in PL/Python by removing it altogether, insteadAlvaro Herrera
relying on stringinfo.c. This fixes a problem reported by Marko Kreen, but I didn't use his patch, per subsequent discussion.
2007-11-22Prevent Perl from introducing a possibly-incompatible definition of typeTom Lane
"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.
2007-11-16GIN index build's allocatedMemory counter needs to be long, not uint32.Tom Lane
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.
2007-11-15Update timezone data files to release 2007i of the zic database.Tom Lane
2007-11-09Second pass at improving LIKE/regex estimation in non-C locales. It turnsTom Lane
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.
2007-11-08If an index depends on no columns of its table, give it a dependency on theTom Lane
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.
2007-11-07Improve the performance of LIKE/regex estimation in non-C locales, by makingTom Lane
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...
2007-11-07Fix patternsel() and callers to do the right thing for NOT LIKE and the otherTom Lane
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.
2007-11-06Fixed two parser bugs.Michael Meskes
2007-10-29- Add check of already changed page while replay WAL. This touches onlyTeodor Sigaev
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>
2007-10-29Fix coredump during replay WAL after crash. Change entrySplitPage() to preventTeodor Sigaev
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.
2007-10-28Fix a couple of issues with pg_dump's handling of inheritance child tablesTom Lane
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.
2007-10-26Change have_join_order_restriction() so that we do not force a clauseless joinTom Lane
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.
2007-10-25Ugly patch to make ALTER SEQUENCE OWNED BY not affect the currval() stateTom Lane
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.
2007-10-24Fix an error in make_outerjoininfo introduced by my patch of 30-Aug: the codeTom Lane
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.
2007-10-15Back-patch some plpython patches previously made only in HEAD: changes ofTom Lane
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.
2007-10-13Fix ALTER COLUMN TYPE to preserve the tablespace and reloptions of indexesTom Lane
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.
2007-10-11Ensure that the result of evaluating a function during constant-expressionTom Lane
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.
2007-10-09Don't try to free pgpassfile since it's a stack variable.Magnus Hagander
Martin Pitt
2007-10-04Keep the planner from failing on "WHERE false AND something IN (SELECT ...)".Tom Lane
eval_const_expressions simplifies this to just "WHERE false", but we have already done pull_up_IN_clauses so the IN join will be done, or at least planned, anyway. The trouble case comes when the sub-SELECT is itself a join and we decide to implement the IN by unique-ifying the sub-SELECT outputs: with no remaining reference to the output Vars in WHERE, we won't have propagated the Vars up to the upper join point, leading to "variable not found in subplan target lists" error. Fix by adding an extra scan of in_info_list and forcing all Vars mentioned therein to be propagated up to the IN join point. Per bug report from Miroslav Sulc.
2007-10-04Update timezone data files to release 2007h of the zic database.Tom Lane
Might as well have the latest when we wrap 8.3beta1.
2007-09-29Disallow CLUSTER using an invalid index (that is, one left over from a failedTom Lane
CREATE INDEX CONCURRENTLY). Such an index might not have entries for every heap row and thus clustering with it would result in silent data loss. The scenario requires a pretty foolish DBA, but still ...
2007-09-29Make archive recovery always start a new timeline, rather than only when aTom Lane
recovery stop time was used. This avoids a corner-case risk of trying to overwrite an existing archived copy of the last WAL segment, and seems simpler and cleaner all around than the original definition. Per example from Jon Colverson and subsequent analysis by Simon.
2007-09-27Fix Assert failure in ExpandColumnRefStar --- what I thought was a can'tTom Lane
happen condition can happen given incorrect input. The real problem is that gram.y should try harder to distinguish * from "*" --- the latter is a legal column name per spec, and someday we ought to treat it that way. However fixing that is too invasive for a back-patch, and it's too late for the 8.3 cycle too. So just reduce the Assert to a plain elog for now. Per report from NikhilS.
2007-09-24Reduce the size of memory allocations by lazy vacuum when processing a smallAlvaro Herrera
table, by allocating just enough for a hardcoded number of dead tuples per page. The current estimate is 200 dead tuples per page. Per reports from Jeff Amiel, Erik Jones and Marko Kreen, and subsequent discussion. CVS: ---------------------------------------------------------------------- CVS: Enter Log. Lines beginning with `CVS:' are removed automatically CVS: CVS: Committing in . CVS: CVS: Modified Files: CVS: commands/vacuumlazy.c CVS: ----------------------------------------------------------------------
2007-09-22Fix erroneous Assert() in syslogger process start in EXEC_BACKEND case,Tom Lane
per ITAGAKI Takahiro. Also, rewrite syslogger_forkexec() in hopes of eliminating the confusion in the first place.
2007-09-22Fix bogus calculation of potential output string length in translate().Tom Lane
2007-09-19Prevent corr() from returning the wrong results for negative correlationNeil Conway
values. The previous coding essentially assumed that x = sqrt(x*x), which does not hold for x < 0. Thanks to Jie Zhang at Greenplum and Gavin Sherry for reporting this issue.
2007-09-16Fix overflow in extract(epoch from interval) for intervals exceeding 68 years.Tom Lane
Seems to have been introduced in 8.1 by careless SECS_PER_DAY search-and-replace.
2007-09-16Fix aboriginal mistake in lazy VACUUM's code for truncating awayTom Lane
no-longer-needed pages at the end of a table. We thought we could throw away pages containing HEAPTUPLE_DEAD tuples; but this is not so, because such tuples very likely have index entries pointing at them, and we wouldn't have removed the index entries. The problem only emerges in a somewhat unlikely race condition: the dead tuples have to have been inserted by a transaction that later aborted, and this has to have happened between VACUUM's initial scan of the page and then rechecking it for empty in count_nondeletable_pages. But that timespan will include an index-cleaning pass, so it's not all that hard to hit. This seems to explain a couple of previously unsolved bug reports.
2007-09-14Fix missed version-stamping.Tom Lane
2007-09-13Translation updatesPeter Eisentraut
2007-09-12Add a CHECK_FOR_INTERRUPTS call in the site where the vacuum delay pointAlvaro Herrera
was removed.
2007-09-11Sync timezone data with 2007g zic release.Tom Lane
2007-09-11Stamp releases 8.2.5, 8.1.10, 8.0.14, 7.4.18, 7.3.20.Bruce Momjian
Update FAQs for 8.2.5.
2007-09-11Make sure that open hash table scans are cleaned up when bgwriter tries toTom Lane
recover from elog(ERROR). Problem was created by introduction of hash seq search tracking awhile back, and affects all branches that have bgwriter; in HEAD the disease has snuck into autovacuum and walwriter too. (Not sure that the latter two use hash_seq_search at the moment, but surely they might someday.) Per report from Sergey Koposov.
2007-09-10Make CLUSTER and REINDEX silently skip remote temp tables in theirAlvaro Herrera
database-wide editions. Per report from bitsandbytes88 <at> hotmail.com and subsequent discussion.
2007-09-10Remove the vacuum_delay_point call in count_nondeletable_pages, because we holdAlvaro Herrera
an exclusive lock on the table at this point, which we want to release as soon as possible. This is called in the phase of lazy vacuum where we truncate the empty pages at the end of the table. An alternative solution would be to lower the vacuum delay settings before starting the truncating phase, but this doesn't work very well in autovacuum due to the autobalancing code (which can cause other processes to change our cost delay settings). This case could be considered in the balancing code, but it is simpler this way.
2007-09-07Improve page split in rtree emulation. Now if splitted result hasTeodor Sigaev
big misalignement, then it tries to split page basing on distribution of boxe's centers. Per report from Dolafi, Tom <dolafit@janelia.hhmi.org> Backpatch is needed, changes doesn't affect on-disk storage.