summaryrefslogtreecommitdiff
path: root/src/backend/commands
AgeCommit message (Collapse)Author
2005-01-10Phase 1 of fix for 'SMgrRelation hashtable corrupted' problem. ThisTom Lane
is the minimum required fix. I want to look next at taking advantage of it by simplifying the message semantics in the shared inval message queue, but that part can be held over for 8.1 if it turns out too ugly.
2005-01-01Update copyrights that were missed.Bruce Momjian
2004-12-31Tag appropriate files for rc3PostgreSQL Daemon
Also performed an initial run through of upgrading our Copyright date to extend to 2005 ... first run here was very simple ... change everything where: grep 1996-2004 && the word 'Copyright' ... scanned through the generated list with 'less' first, and after, to make sure that I only picked up the right entries ...
2004-12-23Avoid memory leakage during VACUUM FULL when an index expression orTom Lane
index predicate uses temporary memory for evaluation. Per example from Jean-Gerard Pailloncy.
2004-12-12PREPARE and EXPLAIN need to copy the source query just like we recentlyTom Lane
had to do in DECLARE CURSOR. AFAICS these are all the places affected. PREPARE case per example from Michael Fuhr, EXPLAIN case located by grepping for planner calls ...
2004-12-06ActiveSnapshot must be set to something valid while running deferredTom Lane
triggers during COMMIT. Per trouble report from Frank van Vugt.
2004-12-03Use StrNCpy not strncpy to fill hash key, to ensure the resulting keyTom Lane
is null-terminated. I think this is not a real bug because the parser would always have truncated the identifier to NAMEDATALEN-1 already, but let's be safe. Per report from Klocwork.
2004-12-03> If it bothers you that much. I'd make a flag, cleared at the start ofBruce Momjian
> each COPY, and then where we test for CR or LF in CopyAttributeOutCSV, > if the flag is not set then set it and issue the warning. Andrew Dunstan
2004-12-02Disallow the combination VACUUM FULL FREEZE for safety's sake, for theTom Lane
reasons I outlined in pghackers a few days ago. Also, undo someone's overly optimistic decision to reduce tuple state checks from if (...) elog() to Asserts. If I trusted this code more, I might think it was a good idea to disable these checks in production installations. But I don't.
2004-12-01Change planner to use the current true disk file size as its estimate ofTom Lane
a relation's number of blocks, rather than the possibly-obsolete value in pg_class.relpages. Scale the value in pg_class.reltuples correspondingly to arrive at a hopefully more accurate number of rows. When pg_class contains 0/0, estimate a tuple width from the column datatypes and divide that into current file size to estimate number of rows. This improved methodology allows us to jettison the ancient hacks that put bogus default values into pg_class when a table is first created. Also, per a suggestion from Simon, make VACUUM (but not VACUUM FULL or ANALYZE) adjust the value it puts into pg_class.reltuples to try to represent the mean tuple density instead of the minimal density that actually prevails just after VACUUM. These changes alter the plans selected for certain regression tests, so update the expected files accordingly. (I removed join_1.out because it's not clear if it still applies; we can add back any variant versions as they are shown to be needed.)
2004-11-28Avoid scribbling on original parsetree during DECLARE CURSOR. ThisTom Lane
prevents problems when the DECLARE is in a portal and is executed repeatedly, as is possible in v3 protocol. Per analysis by Oliver Jowett, though I didn't use his patch exactly.
2004-11-18Force pg_database updates out to disk immediately after ALTER DATABASE;Tom Lane
this is to avoid scenarios where incoming backends find no live copies of a database's row because the only live copy is in an as-yet-unwritten shared buffer, which they can't see. Also, use FlushRelationBuffers() for forcing out pg_database, instead of the much more expensive BufferSync(). There's no need to write out pages belonging to other relations.
2004-11-16Prevent a backend crash when processing CREATE TABLE commands withNeil Conway
more than 65K columns, or when the created table has more than 65K columns due to adding inherited columns from parent relations. Fix a similar crash when processing SELECT queries with more than 65K target list entries. In all three cases we would eventually detect the error and elog, but the check was being made too late.
2004-11-14There is no need for ReadBuffer() call sites to check that the returnedNeil Conway
buffer is valid, as ReadBuffer() will elog on error. Most of the call sites of ReadBuffer() got this right, but this patch fixes those call sites that did not.
2004-11-06When implementing a coercion to a domain type with a combinedTom Lane
type-and-length coercion function, make sure that the coercion function is told the correct typmod. Fixes Kris Jurka's example of a domain over bit(N).
2004-11-05Create 'default_tablespace' GUC variable that supplies a TABLESPACETom Lane
clause implicitly whenever one is not given explicitly. Remove concept of a schema having an associated tablespace, and simplify the rules for selecting a default tablespace for a table or index. It's now just (a) explicit TABLESPACE clause; (b) default_tablespace if that's not an empty string; (c) database's default. This will allow pg_dump to use SET commands instead of tablespace clauses to determine object locations (but I didn't actually make it do so). All per recent discussions.
2004-11-05Small message clarificationsPeter Eisentraut
2004-10-30I found a corner case in which it is possible for RI_FKey_check's callTom Lane
of HeapTupleSatisfiesItself() to trigger a hint-bit update on the tuple: if the row was updated or deleted by a subtransaction of my own transaction that was later rolled back. This cannot occur in pre-8.0 of course, so the hint-bit patch applied a couple weeks ago is OK for existing releases. But for 8.0 it seems we had better fix things so that RI_FKey_check can pass the correct buffer number to HeapTupleSatisfiesItself. Accordingly, add fields to the TriggerData struct to carry the buffer ID(s) for the old and new tuple(s). There are other possible solutions but this one seems cleanest; it will allow other AFTER-trigger functions to safely do tqual.c calls if they want to. Put new fields at end of struct so that there is no API breakage.
2004-10-29Fix failure to think clearly about encoding conversion errors in COPY.Tom Lane
We can't regurgitate the unconverted string as I first thought, because the elog.c mechanisms will assume the error message data is in the server encoding and attempt a reverse conversion. Eventually it might be worth providing a short-circuit path to support this, but for now the simplest solution is to abandon trying to report back the line contents after a conversion failure. Per bug report from Sil Lee, 27-Oct-2004.
2004-10-28On Windows, force a checkpoint just before dropping a database's physicalTom Lane
files and directories. This ensures that the bgwriter will close any open file references it is holding for files therein, which is needed for the rmdir() to succeed. Andrew Dunstan and Tom Lane.
2004-10-26Make heap_fetch API more consistent by having the buffer remain pinnedTom Lane
in all cases when keep_buf = true. This allows ANALYZE's inner loop to use heap_release_fetch, which saves multiple buffer lookups for the same page and avoids overestimation of cost by the vacuum cost mechanism.
2004-10-25In the new dispensation where REINDEX doesn't take exclusive lock onTom Lane
the parent table, it's essential that all index accesses take some kind of lock on the index. I had missed vacuumlazy.c :-( ...
2004-10-25Modify hash_create() to elog(ERROR) if an error occurs, rather thanNeil Conway
returning a NULL pointer (some callers remembered to check the return value, but some did not -- it is safer to just bail out). Also, cleanup pgstat.c to use elog(ERROR) rather than elog(LOG) followed by exit().
2004-10-22In ALTER COLUMN TYPE, strip any implicit coercion operations appearingTom Lane
at the top level of the column's old default expression before adding an implicit coercion to the new column type. This seems to satisfy the principle of least surprise, as per discussion of bug #1290.
2004-10-21Disallow referential integrity actions from being deferred; only theTom Lane
NO ACTION check is deferrable. This seems to be a closer approximation to what the SQL spec says than what we were doing before, and it prevents some anomalous behaviors that are possible now that triggers can fire during the execution of PL functions. Stephan Szabo.
2004-10-17Give a more user-friendly error message in situation where CREATE DATABASETom Lane
specifies a new default tablespace and the template database already has some tables in that tablespace. There isn't any way to solve this fully without modifying the clone database's pg_class contents, so for now the best we can do is issue a better error message.
2004-10-16Give a more user-friendly error message in case where a table is createdTom Lane
in a schema whose default tablespace has been dropped.
2004-10-15Repair possible failure to update hint bits back to disk, perTom Lane
http://archives.postgresql.org/pgsql-hackers/2004-10/msg00464.php. This fix is intended to be permanent: it moves the responsibility for calling SetBufferCommitInfoNeedsSave() into the tqual.c routines, eliminating the requirement for callers to test whether t_infomask changed. Also, tighten validity checking on buffer IDs in bufmgr.c --- several routines were paranoid about out-of-range shared buffer numbers but not about out-of-range local ones, which seems a tad pointless.
2004-10-12Message style revisionsPeter Eisentraut
2004-10-07Adjust comments previously moved to column 1 by pgident.Bruce Momjian
2004-10-07Back out unindented modification to file.Bruce Momjian
2004-10-07Indent comment pushed to new line by else so it is indented by BSDBruce Momjian
indent.
2004-09-30Adjust index locking rules as per my proposal of earlier today. YouTom Lane
now are supposed to take some kind of lock on an index whenever you are going to access the index contents, rather than relying only on a lock on the parent table.
2004-09-30Remove unnecessary use of index_open just to get the index name.Tom Lane
2004-09-27Code cleanup: don't bother casting the argument to pfree() to void *Neil Conway
from another pointer type. Per C89, this is unnecessary, and it is common practice throughout the rest of the tree anyway.
2004-09-24GUC assign hooks that look at external state in deciding whether aTom Lane
setting is valid must ignore that state and permit the assignment anyway when source is PGC_S_OVERRIDE. Otherwise they may disallow a rollback at transaction abort, which is The Wrong Thing. Per example from Michael Fuhr 12-Sep-04.
2004-09-23Fix ALTER TABLE OWNER to adjust the ownership of dependent sequences,Tom Lane
not only indexes. Alvaro Herrera, with some kibitzing by Tom Lane.
2004-09-16Restructure subtransaction handling to reduce resource consumption,Tom Lane
as per recent discussions. Invent SubTransactionIds that are managed like CommandIds (ie, counter is reset at start of each top transaction), and use these instead of TransactionIds to keep track of subtransaction status in those modules that need it. This means that a subtransaction does not need an XID unless it actually inserts/modifies rows in the database. Accordingly, don't assign it an XID nor take a lock on the XID until it tries to do that. This saves a lot of overhead for subtransactions that are only used for error recovery (eg plpgsql exceptions). Also, arrange to release a subtransaction's XID lock as soon as the subtransaction exits, in both the commit and abort cases. This avoids holding many unique locks after a long series of subtransactions. The price is some additional overhead in XactLockTableWait, but that seems acceptable. Finally, restructure the state machine in xact.c to have a more orthogonal set of states for subtransactions.
2004-09-13Redesign query-snapshot timing so that volatile functions in READ COMMITTEDTom Lane
mode see a fresh snapshot for each command in the function, rather than using the latest interactive command's snapshot. Also, suppress fresh snapshots as well as CommandCounterIncrement inside STABLE and IMMUTABLE functions, instead using the snapshot taken for the most closely nested regular query. (This behavior is only sane for read-only functions, so the patch also enforces that such functions contain only SELECT commands.) As per my proposal of 6-Sep-2004; I note that I floated essentially the same proposal on 19-Jun-2002, but that discussion tailed off without any action. Since 8.0 seems like the right place to be taking possibly nontrivial backwards compatibility hits, let's get it done now.
2004-09-11Renumber SnapshotNow and the other special snapshot codes so thatTom Lane
((Snapshot) NULL) can no longer be confused with a valid snapshot, as per my recent suggestion. Define a macro InvalidSnapshot for 0. Use InvalidSnapshot instead of SnapshotAny as the do-nothing special case for heap_update and heap_delete crosschecks; this seems a little cleaner even though the behavior is really the same.
2004-09-10Fire non-deferred AFTER triggers immediately upon query completion,Tom Lane
rather than when returning to the idle loop. This makes no particular difference for interactively-issued queries, but it makes a big difference for queries issued within functions: trigger execution now occurs before the calling function is allowed to proceed. This responds to numerous complaints about nonintuitive behavior of foreign key checking, such as http://archives.postgresql.org/pgsql-bugs/2004-09/msg00020.php, and appears to be required by the SQL99 spec. Also take the opportunity to simplify the data structures used for the pending-trigger list, rename them for more clarity, and squeeze out a bit of space.
2004-09-08Minor efficiency improvements in keeping track of trigger deferredTom Lane
status. In particular, I see no reason for deferredTriggerCheckState to make an explicit entry to note that a particular trigger has its default state --- that just clutters a list that should normally be empty or very short. I have plans to revise this module much more heavily, but this is a simple separable improvement.
2004-09-07Fix a couple of small errors in trigger-list management, as per recentTom Lane
discussion.
2004-09-06Fix a number of places where brittle data structures or overly strongTom Lane
Asserts would lead to a server core dump if an error occurred while trying to abort a failed subtransaction (thereby leading to re-execution of whatever parts of AbortSubTransaction had already run). This of course does not prevent such an error from creating an infinite loop, but at least we don't make the situation worse. Responds to an open item on the subtransactions to-do list.
2004-09-02Remove obsolete comment.Tom Lane
2004-08-31needs_toast_table() should ignore dropped columns.Tom Lane
2004-08-31Code review for various recent GUC hacking. Don't elog(ERROR) whenTom Lane
not supposed to (fixes problem with postmaster aborting due to mistaken postgresql.conf change); don't call superuser() when not inside a transaction (fixes coredump when, eg, try to set log_statement from PGOPTIONS); some message style guidelines enforcement.
2004-08-31copy_relation_data was mistakenly assuming that the source relationTom Lane
would always be already open at the smgr level. Per bug report from Fabien Coelho.
2004-08-30Dept. of second thoughts: it'd be a good idea to flush buffersTom Lane
during replay of CREATE DATABASE as well as the first time around. Else it's possible that the copy operation will copy obsolete blocks. We are still a long way from guaranteeing anything about using a recently-written database as a CREATE template, but this seems needed to ensure the existing behavior holds up during replay.
2004-08-30Another pgindent run with lib typedefs added.Bruce Momjian