summaryrefslogtreecommitdiff
path: root/src/backend
AgeCommit message (Collapse)Author
2006-02-14Move btbulkdelete's vacuum_delay_point() call to a place in the loop whereTom Lane
we are not holding a buffer content lock; where it was, InterruptHoldoffCount is positive and so we'd not respond to cancel signals as intended. Also add missing vacuum_delay_point() call in btvacuumcleanup. This should fix complaint from Evgeny Gridasov about failure to respond to SIGINT/SIGTERM in a timely fashion (bug #2257).
2006-02-14Add some missing vacuum_delay_point calls in GIST vacuuming.Tom Lane
2006-02-13Fix qual_is_pushdown_safe to not try to push down quals involving a whole-rowTom Lane
Var referencing the subselect output. While this case could possibly be made to work, it seems not worth expending effort on. Per report from Magnus Naeslund(f).
2006-02-12Fix bug that allowed any logged-in user to SET ROLE to any other database userTom Lane
id (CVE-2006-0553). Also fix related bug in SET SESSION AUTHORIZATION that allows unprivileged users to crash the server, if it has been compiled with Asserts enabled. The escalation-of-privilege risk exists only in 8.1.0-8.1.2. However, the Assert-crash risk exists in all releases back to 7.3. Thanks to Akio Ishida for reporting this problem.
2006-02-10Check that SID is enabled while checking for Windows admin privileges.Tom Lane
Magnus
2006-02-10Change search for default operator classes so that it examines all opclassesTom Lane
regardless of the current schema search path. Since CREATE OPERATOR CLASS only allows one default opclass per datatype regardless of schemas, this should have minimal impact, and it fixes problems with failure to find a desired opclass while restoring dump files. Per discussion at http://archives.postgresql.org/pgsql-hackers/2006-02/msg00284.php. Remove now-redundant-or-unused code in typcache.c and namespace.c, and backpatch as far as 8.0.
2006-02-09Reject out-of-range dates in date_in().Tom Lane
Kris Jurka
2006-02-01Set progname early in the postmaster/postgres binary, rather than doingBruce Momjian
it later. This fixes a problem where EXEC_BACKEND didn't have progname set, causing a segfault if log_min_messages was set below debug2 and our own snprintf.c was being used. Also alway strdup() progname. Backpatch to 8.1.X and 8.0.X.
2006-01-31Allow %TYPE to be used with SETOF, per gripe from Murat Tasan.Tom Lane
2006-01-30Fix ALTER COLUMN TYPE bug: it sometimes tried to drop UNIQUE or PRIMARY KEYTom Lane
constraints before FOREIGN KEY constraints that depended on them. Originally reported by Neil Conway on 29-Jun-2005. Patch by Nakano Yoshihisa.
2006-01-29When building a bitmap scan, must copy the bitmapqualorig expression treeTom Lane
to avoid sharing substructure with the lower-level indexquals. This is currently only an issue if there are SubPlans in the indexquals, which is uncommon but not impossible --- see bug #2218 reported by Nicholas Vinen. We use the same kluge for indexqual vs indexqualorig in the index scans themselves ... would be nice to clean this up someday.
2006-01-29Fix code that checks to see if an index can be considered to match the query'sTom Lane
requested sort order. It was assuming that build_index_pathkeys always generates a pathkey per index column, which was not true if implied equality deduction had determined that two index columns were effectively equated to each other. Simplest fix seems to be to install an option that causes build_index_pathkeys to support this behavior as well as the original one. Per report from Brian Hirt.
2006-01-26Fix display of whole-row Var appearing at the top level of a SELECT list.Tom Lane
While we normally prefer the notation "foo.*" for a whole-row Var, that does not work at SELECT top level, because in that context the parser will assume that what is wanted is to expand the "*" into a list of separate target columns, yielding behavior different from a whole-row Var. We have to emit just "foo" instead in that context. Per report from Sokolov Yura.
2006-01-24Fix unportable usage of socklen_t: should use ACCEPT_TYPE_ARG3 macroTom Lane
provided by configure, instead. Per bug #2205.
2006-01-21Repair longstanding bug in slru/clog logic: it is possible for two backendsTom Lane
to try to create a log segment file concurrently, but the code erroneously specified O_EXCL to open(), resulting in a needless failure. Before 7.4, it was even a PANIC condition :-(. Correct code is actually simpler than what we had, because we can just say O_CREAT to start with and not need a second open() call. I believe this accounts for several recent reports of hard-to-reproduce "could not create file ...: File exists" errors in both pg_clog and pg_subtrans.
2006-01-20Fix thinko in autovacuum's test to skip temp tables: want to skip anyTom Lane
temp table not only our own process' tables. It's not real important since vacuum.c will skip temp tables anyway, but might as well make the code do what it claims to do.
2006-01-19Add some test scaffolding to allow cache-flush stress testing (and I doTom Lane
mean stress ... system is orders of magnitude slower with this enabled).
2006-01-19Avoid crashing if relcache flush occurs while trying to load data into anTom Lane
index's support-function cache (in index_getprocinfo). Since none of that data can change for an index that's in active use, it seems sufficient to treat all open indexes the same way we were treating "nailed" system indexes --- that is, just re-read the pg_class row and leave the rest of the relcache entry strictly alone. The pg_class re-read might not be strictly necessary either, but since the reltablespace and relfilenode can change in normal operation it seems safest to do it. (We don't support changing any of the other info about an index at all, at the moment.) Back-patch as far as 8.0. It might be possible to adapt the patch to 7.4, but it would take more work than I care to expend for such a low-probability problem. 7.3 is out of luck for sure.
2006-01-19It turns out that TablespaceCreateDbspace fails badly if a relcache flushTom Lane
occurs when it tries to heap_open pg_tablespace. When control returns to smgrcreate, that routine will be holding a dangling pointer to a closed SMgrRelation, resulting in mayhem. This is of course a consequence of the violation of proper module layering inherent in having smgr.c call a tablespace command routine, but the simplest fix seems to be to change the locking mechanism. There's no real need for TablespaceCreateDbspace to touch pg_tablespace at all --- it's only opening it as a way of locking against a parallel DROP TABLESPACE command. A much better answer is to create a special-purpose LWLock to interlock these two operations. This drops TablespaceCreateDbspace quite a few layers down the food chain and makes it something reasonably safe for smgr to call.
2006-01-19Fix a tiny memory leak (one List header) in RelationCacheInvalidate().Tom Lane
This is utterly insignificant in normal operation, but it becomes a problem during cache inval stress testing. The original coding in fact had no leak --- the 8.0 List rewrite created the issue. I wonder whether list_concat should pfree the discarded header?
2006-01-18Modify pgstats code to reduce performance penalties from oversized stats dataTom Lane
files: avoid creating stats hashtable entries for tables that aren't being touched except by vacuum/analyze, ensure that entries for dropped tables are removed promptly, and tweak the data layout to avoid storing useless struct padding. Also improve the performance of pgstat_vacuum_tabstat(), and make sure that autovacuum invokes it exactly once per autovac cycle rather than multiple times or not at all. This should cure recent complaints about 8.1 showing much higher stats I/O volume than was seen in 8.0. It'd still be a good idea to revisit the design with an eye to not re-writing the entire stats dataset every half second ... but that would be too much to backpatch, I fear.
2006-01-17Fix fsync code to test whether F_FULLFSYNC is available, instead ofTom Lane
assuming it always is on Darwin. Per report from Neil Brandt.
2006-01-17Repair problems with the result of lookup_rowtype_tupdesc() possibly beingTom Lane
discarded by cache flush while still in use. This is a minimal patch that just copies the tupdesc anywhere it could be needed across a flush. Applied to back branches only; Neil Conway is working on a better long-term solution for HEAD.
2006-01-12We neglected to apply domain constraints on UNKNOWN parameters toNeil Conway
prepared statements, per report from David Wheeler.
2006-01-12Repair "Halloween problem" in EvalPlanQual: a tuple that's been inserted byTom Lane
our own command (or more generally, xmin = our xact and cmin >= current command ID) should not be seen as good. Else we may try to update rows we already updated. This error was inserted last August while fixing the even bigger problem that the old coding wouldn't see *any* tuples inserted by our own transaction as good. Per report from Euler Taveira de Oliveira.
2006-01-10Improve error messages for missing-FROM-entry cases, as per recent discussion.Tom Lane
2006-01-07Add RelationOpenSmgr() calls to ensure rd_smgr is valid when we try toTom Lane
use it. While it normally has been opened earlier during btree index build, testing shows that it's possible for the link to be closed again if an sinval reset occurs while the index is being built.
2006-01-07During CatCacheRemoveCList, we must now remove any members that areTom Lane
dead and have become unreferenced. Before 8.1, such members were left for AtEOXact_CatCache() to clean up, but now AtEOXact_CatCache isn't supposed to have anything to do. In an assert-enabled build this bug leads to an assertion failure at transaction end, but in a non-assert build the dead member is effectively just a small memory leak. Per report from Jeremy Drake.
2006-01-06Fix failure to apply domain constraints to a NULL constant that's added toTom Lane
an INSERT target list during rule rewriting. Per report from John Supplee.
2006-01-06Fix Windows-only postmaster code to reject a connection request and continue,Tom Lane
rather than elog(FATAL), when there is no more room in ShmemBackendArray. This is a security issue since too many connection requests arriving close together could cause the postmaster to shut down, resulting in denial of service. Reported by Yoshiyuki Asaba, fixed by Magnus Hagander.
2006-01-06Convert Assert checking for empty page into a regular test and elog.Tom Lane
The consequences of overwriting a non-empty page are bad enough that we should not omit this test in production builds.
2006-01-06Fix ReadBuffer() to correctly handle the case where it's trying to extendTom Lane
the relation but it finds a pre-existing valid buffer. The buffer does not correspond to any page known to the kernel, so we *must* do smgrextend to ensure that the space becomes allocated. The 7.x branches all do this correctly, but the corner case got lost somewhere during 8.0 bufmgr rewrites. (My fault no doubt :-( ... I think I assumed that such a buffer must be not-BM_VALID, which is not so.)
2006-01-05Translation updatePeter Eisentraut
2006-01-05Arrange to set the LC_XXX environment variables to match our locale setup.Tom Lane
Back-patch of previous fix in HEAD for plperl-vs-locale issue.
2006-01-04Fix another case in which autovacuum would fail while analyzingTom Lane
expressional indexes. Per report from Brian Hirt.
2006-01-02Reset flex state in a way that works for both flex 2.5.4 and 2.5.31.Tom Lane
2006-01-01Rewrite ProcessConfigFile() to avoid misbehavior at EOF, as per reportTom Lane
from Andrus Moor. The former state-machine-style coding wasn't actually doing much except obscuring the control flow, and it didn't extend readily to fix this case, so I just took it out. Also, add a YY_FLUSH_BUFFER call to ensure the lexer is reset correctly if the previous scan failed partway through the file.
2006-01-01Remove DOS line endings ("\r\n") from several .po files. DOS line endingsNeil Conway
are inconsistent with the rest of the .po files, and apparently cause problems for Sun's cc. Per report on IRC from "bitvector2".
2005-12-30Repair EXPLAIN failure when trying to display a plan condition that involvesTom Lane
selection of a field from the result of a function returning RECORD. I believe this case is new in 8.1; it's due to the addition of OUT parameters. Per example from Michael Fuhr.
2005-12-28Add regression tests for CSV and \., and add automatic quoting of aBruce Momjian
single column dump that has a \. value, so the load works properly. I also added documentation describing this issue. Backpatch to 8.1.X.
2005-12-27Our code had:Bruce Momjian
if (c == '\\' && cstate->line_buf.len == 0) The problem with that is the because of the input and _output_ buffering, cstate->line_buf.len could be zero even if we are not on the first character of a line. In fact, for a typical line, it is zero for all characters on the line. The proper solution is to introduce a boolean, first_char_in_line, that we set as we enter the loop and clear once we process a character. I have restructured the line-reading code in copy.c by: o merging the CSV/non-CSV functions into a single function o used macros to centralize and clarify the buffering code o updated comments o renamed client_encoding_only to encoding_embeds_ascii o added a high-bit test to the encoding_embeds_ascii test for performance o in CSV mode, allow a backslash followed by a non-period to continue being processed as a data value There should be no performance impact from this patch because it is functionally equivalent. If you apply the patch you will see copy.c is much clearer in this area now and might suggest additional optimizations. I have also attached a 8.1-only patch to fix the CSV \. handling bug with no code restructuring.
2005-12-24Fix long standing Asian multibyte charsets bug.Tatsuo Ishii
See: Subject: [HACKERS] bugs with certain Asian multibyte charsets From: Tatsuo Ishii <ishii@sraoss.co.jp> To: pgsql-hackers@postgresql.org Date: Sat, 24 Dec 2005 18:25:33 +0900 (JST) for more details.
2005-12-24Fix for rearranging encoding id ISO-8859-5 to ISO-8859-8.Tatsuo Ishii
Also make the code more robust by searching for target encoding in the internal charset map. Problem reported by Sagi Bashari on 2005/12/21. See "[BUGS] BUG #2120: Crash when doing UTF8<->ISO_8859_8 encoding conversion" on pgsql-bugs list for more details. Back patch for 8.1_STABLE.
2005-12-22Adjust string comparison so that only bitwise-equal strings are consideredTom Lane
equal: if strcoll claims two strings are equal, check it with strcmp, and sort according to strcmp if not identical. This fixes inconsistent behavior under glibc's hu_HU locale, and probably under some other locales as well. Also, take advantage of the now-well-defined behavior to speed up texteq, textne, bpchareq, bpcharne: they may as well just do a bitwise comparison and not bother with strcoll at all. NOTE: affected databases may need to REINDEX indexes on text columns to be sure they are self-consistent.
2005-12-14Defend against crash while processing Describe Statement or Describe PortalTom Lane
messages, when client attempts to execute these outside a transaction (start one) or in a failed transaction (reject message, except for COMMIT/ROLLBACK statements which we can handle). Per report from Francisco Figueiredo Jr.
2005-12-14Fix problem with whole-row Vars referencing sub-select outputs, perTom Lane
example from Jim Dew. Add some simple regression tests, since this is an area we seem to break regularly :-(
2005-12-10Teach deparsing of CASE expressions to cope with the simplified formsTom Lane
that simplify_boolean_equality() may leave behind. This is only relevant if the user writes something a bit silly, like CASE x=y WHEN TRUE THEN. Per example from Michael Fuhr; may or may not explain bug #2106.
2005-12-09Translation updatesPeter Eisentraut
2005-12-08Fix bgwriter's failure to release buffer pins and open files after anTom Lane
error. This probably explains bug #2099 and could also account for mysterious VACUUM hangups.
2005-12-06In a nestloop inner indexscan, it's OK to use pushed-down baserestrictinfoTom Lane
clauses even if it's an outer join. This is a corner case since such clauses could only arise from weird OUTER JOIN ON conditions, but worth fixing. Per example from Ron at cheapcomplexdevices.com.