summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2008-10-31commit for 8.3.5REL8_3_5Marc G. Fournier
2008-10-30Translation updatesPeter Eisentraut
2008-10-30Revert previous patch to put the shared memory segment on win32Magnus Hagander
in the Global\ namespace, because it caused permission errors on a lot of platforms. We need to come up with something better for 8.4, but for now revert to the pre-8.3.4 behaviour.
2008-10-30Update time zone data files to tzdata release 2008i (DST law changes inTom Lane
Argentina, Brazil, Mauritius, Syria).
2008-10-30Improve new messagePeter Eisentraut
2008-10-30Fix recoveryLastXTime logic so that it actually does what one would expect.Tom Lane
Per gripe from Kevin Grittner. Backpatch to 8.3, where the bug was introduced.
2008-10-27Install a more robust solution for the problem of infinite error-processingTom Lane
recursion when we are unable to convert a localized error message to the client's encoding. We've been over this ground before, but as reported by Ibrar Ahmed, it still didn't work in the case of conversion failures for the conversion-failure message itself :-(. Fix by installing a "circuit breaker" that disables attempts to localize this message once we get into recursion trouble. Patch all supported branches, because it is in fact broken in all of them; though I had to add some missing translations to the older branches in order to expose the failure in the particular test case I was using.
2008-10-26Better solution to the IN-list issue: instead of having an arbitrary cutoff,Tom Lane
treat Var and non-Var IN-list items differently. Only non-Var items are candidates to go into an ANY(ARRAY) construct --- we put all Vars as separate OR conditions on the grounds that that leaves more scope for optimization. Per suggestion from Robert Haas.
2008-10-25Add a heuristic to transformAExprIn() to make it prefer expanding "x IN (list)"Tom Lane
into an OR of equality comparisons, rather than x = ANY(ARRAY[...]), when there are Vars in the right-hand side. This avoids a performance regression compared to pre-8.2 releases, in cases where the OR form can be optimized into scans of multiple indexes. Limit the possible downside by preferring this form only when the list isn't very long (I set the cutoff at 32 elements, which is a bit arbitrary but in the right ballpark). Per discussion with Jim Nasby. In passing, also make it try the OR form if it cannot select a common type for the array elements; we've seen a complaint or two about how the OR form worked for such cases and ARRAY doesn't.
2008-10-25Fix an old bug in after-trigger handling: AfterTriggerEndQuery took theTom Lane
address of afterTriggers->query_stack[afterTriggers->query_depth] and hung onto it through all its firings of triggers. However, if a trigger causes sufficiently many nested query executions, query_stack will get repalloc'd bigger, leaving AfterTriggerEndQuery --- and hence afterTriggerInvokeEvents --- using a stale pointer. So far as I can find, the only consequence of this error is to stomp on a couple of words of already-freed memory; which would lead to a failure only if that chunk had already gotten re-allocated for something else. So it's hard to exhibit a simple failure case, but this is surely a bug. I noticed this while working on my recent patch to reduce pending-trigger space usage. The present patch is mighty ugly, because it requires making afterTriggerInvokeEvents know about all the possible event lists it might get called on. Fortunately, this is only needed in back branches because CVS HEAD avoids the problem in a different way: afterTriggerInvokeEvents only touches the passed AfterTriggerEventList pointer once at startup. Back branches are stable enough that wiring in knowledge of all possible call usages doesn't seem like a killer problem. Back-patch to 8.0. 7.4's trigger code is completely different and doesn't seem to have the problem (it doesn't even use repalloc).
2008-10-23Fix memory leak when using gsslib parameter in libpq connectionsMagnus Hagander
2008-10-23On second thought, let's not get involved in correcting the feature listPeter Eisentraut
in 8.3. The list is quite outdated, and fixing it up would require more effort. Plus, we don't want diverging information schema contents.
2008-10-22Fix GiST's killing tuple: GISTScanOpaque->curpos wasn'tTeodor Sigaev
correctly set. As result, killtuple() marks as dead wrong tuple on page. Bug was introduced by me while fixing possible duplicates during GiST index scan.
2008-10-17Small correction SQL feature tablePeter Eisentraut
2008-10-17Fix small bug in headline generation.Teodor Sigaev
Patch from Sushant Sinha <sushant354@gmail.com> http://archives.postgresql.org/pgsql-hackers/2008-07/msg00785.php
2008-10-17During repeated rescan of GiST index it's possible that scan keyTeodor Sigaev
is NULL but SK_SEARCHNULL is not set. Add checking IS NULL of keys to set during key initialization. If key is NULL and SK_SEARCHNULL is not set then nothnig can be satisfied. With assert-enabled compilation that causes coredump. Bug was introduced in 8.3 by support of IS NULL index scan.
2008-10-16Fix a small memory leak in ExecReScanAgg() in the hashed aggregation case.Neil Conway
In the previous coding, the list of columns that needed to be hashed on was allocated in the per-query context, but we reallocated every time the Agg node was rescanned. Since this information doesn't change over a rescan, just construct the list of columns once during ExecInitAgg().
2008-10-16Fix SPI_getvalue and SPI_getbinval to range-check the given attribute numberTom Lane
according to the TupleDesc's natts, not the number of physical columns in the tuple. The previous coding would do the wrong thing in cases where natts is different from the tuple's column count: either incorrectly report error when it should just treat the column as null, or actually crash due to indexing off the end of the TupleDesc's attribute array. (The second case is probably not possible in modern PG versions, due to more careful handling of inheritance cases than we once had. But it's still a clear lack of robustness here.) The incorrect error indication is ignored by all callers within the core PG distribution, so this bug has no symptoms visible within the core code, but it might well be an issue for add-on packages. So patch all the way back.
2008-10-10Fix omission of DiscardStmt in GetCommandLogLevel, per report from HubertTom Lane
Depesz Lubaczewski. In HEAD, also move a couple of other cases to make the code ordering match up with ProcessUtility.
2008-10-10Optional arguments should be optional.Michael Meskes
2008-10-09Fix overly tense optimization of PLpgSQL_func_hashkey: we must representTom Lane
the isTrigger state explicitly, not rely on nonzero-ness of trigrelOid to indicate trigger-hood, because trigrelOid will be left zero when compiling for validation. The (useless) function hash entry built by the validator was able to match an ordinary non-trigger call later in the same session, thereby bypassing the check that is supposed to prevent such a call. Per report from Alvaro. It might be worth suppressing the useless hash entry altogether, but that's a bigger change than I want to consider back-patching. Back-patch to 8.0. 7.4 doesn't have the problem because it doesn't have validation mode.
2008-10-09Fix crash in bytea-to-XML mapping when the source value is toasted.Tom Lane
Report and fix by Michael McMaster. Some minor code beautification by me, also avoid memory leaks in the special-case paths.
2008-10-09Force a checkpoint in CREATE DATABASE before starting to copy the files,Heikki Linnakangas
to process any pending unlinks for the source database. Before, if you dropped a relation in the template database just before CREATE DATABASE, and a checkpoint happened during copydir(), the checkpoint might delete a file that we're just about to copy, causing lstat() in copydir() to fail with ENOENT. Backpatch to 8.3, where the pending unlinks were introduced. Per report by Matthew Wakeling and analysis by Tom Lane.
2008-10-07When a relation is moved to another tablespace, we can't assume that we canHeikki Linnakangas
use the old relfilenode in the new tablespace. There might be another relation in the new tablespace with the same relfilenode, so we must generate a fresh relfilenode in the new tablespace. The 8.3 patch to let deleted relation files linger as zero-length files until the next checkpoint made this more obvious: moving a relation from one table space another, and then back again, caused a collision with the lingering file. Back-patch to 8.1. The issue is present in 8.0 as well, but it doesn't seem worth fixing there, because we didn't have protection from OID collisions after OID wraparound before 8.1. Report by Guillaume Lelarge.
2008-10-02Fix improper display of fractional seconds in interval valuesTom Lane
when using --enable-integer-datetimes and a non-ISO datestyle. Ron Mayer
2008-10-01Link libpq with libgssapi if configure finds it, asMagnus Hagander
required by at least NetBSD. Markus Schaaf
2008-09-30Recent patches to pg_ctl broke "pg_ctl restart" for the case where noTom Lane
command-line options had been given to the postmaster; and just plain broke it altogether in 8.1 and 8.0. Per report from KaiGai Kohei.
2008-09-27Compare escaped chars case insensitively for ILIKE - per gripe from TGL.Andrew Dunstan
2008-09-24Fix more problems with rewriter failing to set Query.hasSubLinks when insertingTom Lane
a SubLink expression into a rule query. We missed cases where the original query contained a sub-SELECT in a function in FROM, a multi-row VALUES list, or a RETURNING list. Per bug #4434 from Dean Rasheed and subsequent investigation. Back-patch to 8.1; older releases don't have the issue because they didn't try to be smart about setting hasSubLinks only when needed.
2008-09-24Make sure pg_control is opened in binary mode, to dealMagnus Hagander
with situtations when the file contains an EOF maker (0x1A) on Windows. ITAGAKI Takahiro
2008-09-19Mark SessionReplicationRole as PGDLLIMPORT so itMagnus Hagander
can be used from Slony functions. Per report from Hiroshi Saito.
2008-09-19tag for 8.3.4REL8_3_4Marc G. Fournier
2008-09-17Update time zone data files to tzdata release 2008f (DST law changes inTom Lane
Argentina, Bahamas, Brazil, Mauritius, Morocco, Pakistan, Palestine, Paraguay).
2008-09-16Widen the nLocks counts in local lock tables from int to int64. ThisTom Lane
forestalls potential overflow when the same table (or other object, but usually tables) is accessed by very many successive queries within a single transaction. Per report from Michael Milligan. Back-patch to 8.0, which is as far back as the patch conveniently applies. There have been no reports of overflow in pre-8.3 releases, but clearly the risk existed all along. (Michael's report suggests that 8.3 may consume lock counts faster than prior releases, but with no test case to look at it's hard to be sure about that. Widening the counts seems a good future-proofing measure in any event.)
2008-09-16Fix multiple memory leaks in xml_out(). Per report from Matt Magoffin.Tom Lane
2008-09-15Fix caching of foreign-key-checking queries so that when a replan is needed,Tom Lane
we regenerate the SQL query text not merely the plan derived from it. This is needed to handle contingencies such as renaming of a table or column used in an FK. Pre-8.3, such cases worked despite the lack of replanning (because the cached plan needn't actually change), so this is a regression. Per bug #4417 from Benjamin Bihler.
2008-09-12Skip opfamily check in eclass_matches_any_index() when the index isn't aTom Lane
btree. We can't easily tell whether clauses generated from the equivalence class could be used with such an index, so just assume that they might be. This bit of over-optimization prevented use of non-btree indexes for nestloop inner indexscans, in any case where the join uses an equality operator that is also a btree operator --- which in particular is typically true for hash indexes. Noted while trying to test the current hash index patch.
2008-09-11Initialize the minimum frozen Xid in vac_update_datfrozenxid usingAlvaro Herrera
GetOldestXmin() instead of RecentGlobalXmin; this is safer because we do not depend on the latter being correctly set elsewhere, and while it is more expensive, this code path is not performance-critical. This is a real risk for autovacuum, because it can execute whole cycles without doing a single vacuum, which would mean that RecentGlobalXmin would stay at its initialization value, FirstNormalTransactionId, causing a bogus value to be inserted in pg_database. This bug could explain some recent reports of failure to truncate pg_clog. At the same time, change the initialization of RecentGlobalXmin to InvalidTransactionId, and ensure that it's set to something else whenever it's going to be used. Using it as FirstNormalTransactionId in HOT page pruning could incur in data loss. InitPostgres takes care of setting it to a valid value, but the extra checks are there to prevent "special" backends from behaving in unusual ways. Per Tom Lane's detailed problem dissection in 29544.1221061979@sss.pgh.pa.us
2008-09-10Avoid using sprintf() for a simple octal conversion in PQescapeByteaInternal.Tom Lane
Improves performance, per suggestion from Rudolf Leitgeb (bug #4414). The backend did this right already, but not libpq.
2008-09-01Fix plpgsql's exec_move_row() to supply valid type OIDs to exec_assign_value()Tom Lane
whenever possible, as per bug report from Oleg Serov. While at it, reorder the operations in the RECORD case to avoid possible palloc failure while the variable update is only partly complete. Back-patch as far as 8.1. Although the code of the particular function is similar in 8.0, 8.0's support for composite fields in rows is sufficiently broken elsewhere that it doesn't seem worth fixing this.
2008-09-01HeapTupleHeaderAdjustCmax made the incorrect assumption that the rawHeikki Linnakangas
command id is the cmin, when it can in fact be a combo cid. That made rows incorrectly invisible to a transaction where a tuple was deleted by multiple aborted subtransactions. Report and patch Karl Schnaitter. Back-patch to 8.3, where combo cids was introduced.
2008-08-29Fix bug in original implementation of xmlserialize(): if user specifiesTom Lane
a target type that isn't acceptable, the code failed to raise the proper error. The result instead was to return a NULL expression tree, which in a quick test led to a 'cache lookup failed for type 0' error later. Patch 8.3 only --- I fixed this in HEAD as part of recent locations patch.
2008-08-26Teach eval_const_expressions() to simplify an ArrayCoerceExpr to a constantTom Lane
when its input is constant and the element coercion function is immutable (or nonexistent, ie, binary-coercible case). This is an oversight in the 8.3 implementation of ArrayCoerceExpr, and its result is that certain cases involving IN or NOT IN with constants don't get optimized as they should be. Per experimentation with an example from Ow Mun Heng.
2008-08-23Fix possible duplicate tuples while GiST scan. Now page is processedTeodor Sigaev
at once and ItemPointers are collected in memory. Remove tuple's killing by killtuple() if tuple was moved to another page - it could produce unaceptable overhead. Backpatch up to 8.1 because the bug was introduced by GiST's concurrency support.
2008-08-20Fixed incorrect argument handling in SET command if argument is a variable.Michael Meskes
2008-08-20Make libpq on windows not try to send chunks larger than 64Kb.Magnus Hagander
Per Microsoft knowledge base article Q201213, early versions of Windows fail when we do this. Later versions of Windows appear to have a higher limit than 64Kb, but do still fail on large sends, so we unconditionally limit it for all versions. Patch from Tom Lane.
2008-08-16Fix pg_dump/pg_restore's ExecuteSqlCommand() to behave suitably if PQexecTom Lane
returns NULL instead of a PGresult. The former coding would fail, which is OK, but it neglected to give you the PQerrorMessage that might tell you why. In the oldest branches, there was another problem: it'd sometimes report PQerrorMessage from the wrong connection.
2008-08-16Synchronize Borland libpq makefile to match MSVC. Backpatch to 8.3.X.Bruce Momjian
2008-08-14Fix pull_up_simple_union_all to copy all rtable entries from child subquery toHeikki Linnakangas
parent, not only those with RangeTblRefs. We need them in ExecCheckRTPerms. Report by Brendan O'Shea. Back-patch to 8.2, where pull_up_simple_union_all was introduced.
2008-08-10Fix corner-case bug introduced with HOT: if REINDEX TABLE pg_class (or aTom Lane
REINDEX DATABASE including same) is done before a session has done any other update on pg_class, the pg_class relcache entry was left with an incorrect setting of rd_indexattr, because the indexed-attributes set would be first demanded at a time when we'd forced a partial list of indexes into the pg_class entry, and it would remain cached after that. This could result in incorrect decisions about HOT-update safety later in the same session. In practice, since only pg_class_relname_nsp_index would be missed out, only ALTER TABLE RENAME and ALTER TABLE SET SCHEMA could trigger a problem. Per report and test case from Ondrej Jirman.