summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2007-07-09Fix stddev_pop(numeric) and var_pop(numeric), which were incorrectly producingTom Lane
the same outputs as stddev_samp() and var_samp() respectively.
2007-07-08Remove the pgstat_drop_relation() call from smgr_internal_unlink(), becauseTom Lane
we don't know at that point which relation OID to tell pgstat to forget. The code was passing the relfilenode, which is incorrect, and could possibly cause some other relation's stats to be zeroed out. While we could try to clean this up, it seems much simpler and more reliable to let the next invocation of pgstat_vacuum_tabstat() fix things; which indeed is how it worked before I introduced the buggy code into 8.1.3 and later :-(. Problem noticed by Itagaki Takahiro, fix is per subsequent discussion.
2007-07-02- Fix the -w (wait) option to work in Windows service mode, per bug #3382.Magnus Hagander
- Prevent the -w option being passed to the postmaster. - Read the postmaster options file when starting as a Windows service. Dave Page
2007-07-02Fix failure to restart Postgres when Linux kernel returns EIDRM for shmctl().Tom Lane
This is a Linux kernel bug that apparently exists in every extant kernel version: sometimes shmctl() will fail with EIDRM when EINVAL is correct. We were assuming that EIDRM indicates a possible conflict with pre-existing backends, and refusing to start the postmaster when this happens. Fortunately, there does not seem to be any case where Linux can legitimately return EIDRM (it doesn't track shmem segments in a way that would allow that), so we can get away with just assuming that EIDRM means EINVAL on this platform. Per reports from Michael Fuhr and Jon Lapham --- it's a bit surprising we have not seen more reports, actually.
2007-07-01Avoid memory leakage when a series of subtransactions invoke AFTER triggersTom Lane
that are fired at end-of-statement (as is the normal case for foreign keys, for example). In this situation the per-subxact deferred trigger context is always empty when subtransaction exit is reached; so we could free it, but were not doing so, leading to an intratransaction leak of 8K or more per subtransaction. Per off-list example from Viatcheslav Kalinin subsequent to bug #3418 (his original bug report omitted a foreign key constraint needed to cause this leak). Back-patch to 8.2; prior versions were not using per-subxact contexts for deferred triggers, so did not have this leak.
2007-06-29Fix a passel of ancient bugs in to_char(), including two distinct bufferTom Lane
overruns (neither of which seem likely to be exploitable as security holes, fortunately, since the provoker can't control the data written). One of these is due to choosing to stomp on the output of a called function, which is bad news in any case; make it treat the called functions' results as read-only. Avoid some unnecessary palloc/pfree traffic too; it's not really helpful to free small temporary objects, and again this is presuming more than it ought to about the nature of the results of called functions. Per report from Patrick Welche and additional code-reading by Imad.
2007-06-28Fix incorrect tests for undef Perl values in some places in plperl.c.Tom Lane
The correct test for defined-ness is SvOK(sv), not anything involving SvTYPE. Per bug #3415 from Matt Taylor. Back-patch as far as 8.0; no apparent problem in 7.x.
2007-06-22In psql, when running a SELECT query using a cursor, flush the queryNeil Conway
output after each FETCH. This ensures that incremental results are available to clients that are executing long-running SELECT queries via the FETCH_COUNT feature.
2007-06-20transformColumnDefinition failed to complain aboutTom Lane
create table foo (bar int default null default 3); due to not thinking about the special-case handling of DEFAULT NULL. Problem noticed while investigating bug #3396.
2007-06-20CREATE DOMAIN ... DEFAULT NULL failed because gram.y special-cases DEFAULTTom Lane
NULL and DefineDomain didn't. Bug goes all the way back to original coding of domains. Per bug #3396 from Sergey Burladyan.
2007-06-14Avoid having autovacuum run multiple ANALYZE commands in a single transaction,Alvaro Herrera
to prevent possible deadlock problems. Per request from Tom Lane.
2007-06-14Implement a chunking protocol for writes to the syslogger pipe, with messagesAndrew Dunstan
reassembled in the syslogger before writing to the log file. This prevents partial messages from being written, which mucks up log rotation, and messages from different backends being interleaved, which causes garbled logs. Backport as far as 8.0, where the syslogger was introduced. Tom Lane and Andrew Dunstan
2007-06-12Fix DecodeDateTime to allow timezone to appear before year. This hadTom Lane
historically worked in some but not all cases, but as of 8.2 it failed for all timezone formats. Fix, and add regression test cases to catch future regressions in this area. Per gripe from Adam Witney.
2007-06-09Allow numeric_fac() to be interrupted, since it can take quite a while forTom Lane
large inputs. Also cause it to error out immediately if the result will overflow, instead of grinding through a lot of calculation first. Per gripe from Jim Nasby.
2007-06-07Avoid losing track of data for shared tables in pgstats. Report by MichaelAlvaro Herrera
Fuhr, patch from Tom Lane after a messier suggestion by me.
2007-06-05Move call of MarkBufferDirty() before XLogInsert() as required.Teodor Sigaev
Many thanks to Heikki Linnakangas <heikki@enterprisedb.com> for his sharp eyes.
2007-06-04Fix bundle bugs of GIN:Teodor Sigaev
- Fix possible deadlock between UPDATE and VACUUM queries. Bug never was observed in 8.2, but it still exist there. HEAD is more sensitive to bug after recent "ring" of buffer improvements. - Fix WAL creation: if parent page is stored as is after split then incomplete split isn't removed during replay. This happens rather rare, only on large tables with a lot of updates/inserts. - Fix WAL replay: there was wrong test of XLR_BKP_BLOCK_* for left page after deletion of page. That causes wrong rightlink field: it pointed to deleted page. - add checking of match of clearing incomplete split - cleanup incomplete split list after proceeding All of this chages doesn't change on-disk storage, so backpatch... But second point may be an issue for replaying logs from previous version.
2007-06-04On win32, retry reading when WSARecv returns WSAEWOULDBLOCK. There seemMagnus Hagander
to be cases when at least Windows 2000 can do this even though select just indicated that the socket is readable. Per report and analysis from Cyril VELTER.
2007-06-04On win32, don't use SO_REUSEADDR for TCP sockets.Magnus Hagander
Per failure on buildfarm member baiji and subsequent discussion.
2007-06-02Fix erroneous error reporting for overlength input in text_date(),Tom Lane
text_time(), and text_timetz(). 7.4-vintage bug found by Greg Stark.
2007-06-01Fix aboriginal bug in BufFileDumpBuffer that would cause it to write theTom Lane
wrong data when dumping a bufferload that crosses a component-file boundary. This probably has not been seen in the wild because (a) component files are normally 1GB apiece and (b) non-block-aligned buffer usage is relatively rare. But it's fairly easy to reproduce a problem if one reduces RELSEG_SIZE in a test build. Kudos to Kurt Harriman for spotting the bug.
2007-06-01Fix performance problems in multi-batch hash joins by ensuring that we selectTom Lane
a well-randomized batch number even when given a poorly-randomized hash value. This is a bit inefficient but seems the only practical solution given the constraint that we can't change the hash functions in released branches. Per report from Joseph Shraibman. Applied to 8.1 and 8.2 only --- HEAD is getting a cleaner fix, and 8.0 and before use different coding that seems less vulnerable.
2007-05-30Fix overly-strict sanity check in BeginInternalSubTransaction that made itTom Lane
fail when used in a deferred trigger. Bug goes back to 8.0; no doubt the reason it hadn't been noticed is that we've been discouraging use of user-defined constraint triggers. Per report from Frank van Vugt.
2007-05-29Fix a bug in input processing for the "interval" type. Previously,Neil Conway
"microsecond" and "millisecond" units were not considered valid input by themselves, which caused inputs like "1 millisecond" to be rejected erroneously. Update the docs, add regression tests, and backport to 8.2 and 8.1
2007-05-22Repair planner bug introduced in 8.2 by ability to rearrange outer joins:Tom Lane
in cases where a sub-SELECT inserts a WHERE clause between two outer joins, that clause may prevent us from re-ordering the two outer joins. The code was considering only the joins' own ON-conditions in determining reordering safety, which is not good enough. Add a "delay_upper_joins" flag to OuterJoinInfo to flag that we have detected such a clause and higher-level outer joins shouldn't be permitted to commute with this one. (This might seem overly coarse, but given the current rules for OJ reordering, it's sufficient AFAICT.) The failure case is actually pretty narrow: it needs a WHERE clause within the RHS of a left join that checks the RHS of a lower left join, but is not strict for that RHS (else we'd have simplified the lower join to a plain join). Even then no failure will be manifest unless the planner chooses to rearrange the join order. Per bug report from Adam Terrey.
2007-05-22Fix best_inner_indexscan to return both the cheapest-total-cost andTom Lane
cheapest-startup-cost innerjoin indexscans, and make joinpath.c consider both of these (when different) as the inside of a nestloop join. The original design was based on the assumption that indexscan paths always have negligible startup cost, and so total cost is the only important figure of merit; an assumption that's obviously broken by bitmap indexscans. This oversight could lead to choosing poor plans in cases where fast-start behavior is more important than total cost, such as LIMIT and IN queries. 8.1-vintage brain fade exposed by an example from Chuck D.
2007-05-21Removed errant ISODOWMichael Meskes
2007-05-21Backported fix from HEAD that removes superfluous function Vista has a ↵Michael Meskes
problem with
2007-05-18Remove redundant logging of send failures when SSL is in use. While pqcomm.cTom Lane
had been taught not to do that ages ago, the SSL code was helpfully bleating anyway. Resolves some recent reports such as bug #3266; however the underlying cause of the related bug #2829 is still unclear.
2007-05-17Temporary fix for the problem that pg_stat_activity, inet_client_addr(),Tom Lane
and inet_server_addr() fail if the client connected over a "scoped" IPv6 address. In this case getnameinfo() will return a string ending with a poorly-standardized "%something" zone specifier, which these functions try to feed to network_in(), which won't take it. So that we don't lose functionality altogether, suppress the zone specifier before giving the string to network_in(). Per report from Brian Hirt. TODO: probably someday the inet type should support scoped IPv6 addresses, and then this patch should be reverted. Backpatch to 8.2 ... is it worth going further?
2007-05-15Avoid emitting empty role names in the GRANTED BY clause of GRANT ROLEAlvaro Herrera
when the grantor has been dropped. This is a workaround for the fact that we don't track the grantor as a shared dependency.
2007-05-12Improve predicate_refuted_by_simple_clause() to handle IS NULL and IS NOT NULLTom Lane
more completely. The motivation for having it understand IS NULL at all was to allow use of "foo IS NULL" as one of the subsets of a partitioning on "foo", but as reported by Aleksander Kmetec, it wasn't really getting the job done. Backpatch to 8.2 since this is arguably a performance bug.
2007-05-11Fix my oversight in enabling domains-of-domains: ALTER DOMAIN ADD CONSTRAINTTom Lane
needs to check the new constraint against columns of derived domains too. Also, make it error out if the domain to be modified is used within any composite-type columns. Eventually we should support that case, but it seems a bit painful, and not suitable for a back-patch. For the moment just let the user know we can't do it. Backpatch to 8.2, which is the only released version that allows nested domains. Possibly the other part should be back-patched further.
2007-05-05Check return code from strxfrm on Windows since it has aMagnus Hagander
non-standard way of indicating errors, so we don't try to allocate INT_MAX bytes to store a result in.
2007-05-01Fix a thinko in my patch of a couple months ago for bug #3116: it did theTom Lane
wrong thing when inlining polymorphic SQL functions, because it was using the function's declared return type where it should have used the actual result type of the current call. In 8.1 and 8.2 this causes obvious failures even if you don't have assertions turned on; in 8.0 and 7.4 it would only be a problem if the inlined expression were used as an input to a function that did run-time type determination on its inputs. Add a regression test, since this is evidently an under-tested area.
2007-04-27Removed non-existant function from extern.hMichael Meskes
2007-04-27Inlined two functions to get rid of va_list prolems on some archs.Michael Meskes
2007-04-26Fix dynahash.c to suppress hash bucket splits while a hash_seq_search() scanTom Lane
is in progress on the same hashtable. This seems the least invasive way to fix the recently-recognized problem that a split could cause the scan to visit entries twice or (with much lower probability) miss them entirely. The only field-reported problem caused by this is the "failed to re-find shared lock object" PANIC in COMMIT PREPARED reported by Michel Dorochevsky, which was caused by multiply visited entries. However, it seems certain that mdsync() is vulnerable to missing required fsync's due to missed entries, and I am fearful that RelationCacheInitializePhase2() might be at risk as well. Because of that and the generalized hazard presented by this bug, back-patch all the supported branches. Along the way, fix pg_prepared_statement() and pg_cursor() to not assume that the hashtables they are examining will stay static between calls. This is risky regardless of the newly noted dynahash problem, because hash_seq_search() has never promised to cope with deletion of table entries other than the just-returned one. There may be no bug here because the only supported way to call these functions is via ExecMakeTableFunctionResult() which will cycle them to completion before doing anything very interesting, but it seems best to get rid of the assumption. This affects 8.2 and HEAD only, since those functions weren't there earlier.
2007-04-24Set maximum semaphore count to 32767 instead of 1. FixesMagnus Hagander
errorcode 298 when unlocking a semaphore more than once. Per report from Marcin Waldowski.
2007-04-23Fix LOCK_DEBUG compilation in the 8.2 branch; HEAD was fixed earlier.Neil Conway
Heikki Linnakangas.
2007-04-20Support explicit placement of the temporary-table schema within search_path.Tom Lane
This is needed to allow a security-definer function to set a truly secure value of search_path. Without it, a malicious user can use temporary objects to execute code with the privileges of the security-definer function. Even pushing the temp schema to the back of the search path is not quite good enough, because a function or operator at the back of the path might still capture control from one nearer the front due to having a more exact datatype match. Hence, disable searching the temp schema altogether for functions and operators. Security: CVE-2007-2138
2007-04-19Sync timezone data with 2007e zic release.Tom Lane
2007-04-19Fix missed PACKAGE_STRING.Tom Lane
2007-04-19Repair PANIC condition in hash indexes when a previous index extension attemptTom Lane
failed (due to lock conflicts or out-of-space). We might have already extended the index's filesystem EOF before failing, causing the EOF to be beyond what the metapage says is the last used page. Hence the invariant maintained by the code needs to be "EOF is at or beyond last used page", not "EOF is exactly the last used page". Problem was created by my patch of 2006-11-19 that attempted to repair bug #2737. Since that was back-patched to 7.4, this needs to be as well. Per report and test case from Vlastimil Krejcir.
2007-04-19Fix plpgsql to avoid reference to already-freed memory when returning aTom Lane
pass-by-reference data type and the RETURN statement is within an EXCEPTION block. Bug introduced by my fix of 2007-01-28 to use per-subtransaction ExprContexts/EStates; since that wasn't back-patched into older branches, only 8.2 and HEAD are affected. Per report from Gary Winslow.
2007-04-19Stamp releases 8.2.4, 8.1.9, 8.0.13, 7.4.17, 7.3.19.Bruce Momjian
2007-04-18Translation updatesPeter Eisentraut
2007-04-17Rewrite choose_bitmap_and() to make it more robust in the presence ofTom Lane
competing alternatives for indexes to use in a bitmap scan. The former coding took estimated selectivity as an overriding factor, causing it to sometimes choose indexes that were much slower to scan than ones with a slightly worse selectivity. It was also too narrow-minded about which combinations of indexes to consider ANDing. The rewrite makes it pay more attention to index scan cost than selectivity; this seems sane since it's impossible to have very bad selectivity with low cost, whereas the reverse isn't true. Also, we now consider each index alone, as well as adding each index to an AND-group led by each prior index, for a total of about O(N^2) rather than O(N) combinations considered. This makes the results much less dependent on the exact order in which the indexes are considered. It's still a lot cheaper than an O(2^N) exhaustive search. A prefilter step eliminates all but the cheapest of those indexes using the same set of WHERE conditions, to keep the effective value of N down in scenarios where the DBA has created lots of partially-redundant indexes.
2007-04-16Don't write timing output in quiet mode.Magnus Hagander
Merlin Moncure
2007-04-16Fix pg_dump to not crash if -t or a similar switch is used to select a serialTom Lane
sequence for dumping without also selecting its owning table. Make it not try to emit ALTER SEQUENCE OWNED BY in this situation. Per report from Michael Nolan.