aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands
Commit message (Collapse)AuthorAge
* Disallow the combination VACUUM FULL FREEZE for safety's sake, for theTom Lane2004-12-02
| | | | | | | | | 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.
* Change planner to use the current true disk file size as its estimate ofTom Lane2004-12-01
| | | | | | | | | | | | | | | | | 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.)
* Avoid scribbling on original parsetree during DECLARE CURSOR. ThisTom Lane2004-11-28
| | | | | | 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.
* Force pg_database updates out to disk immediately after ALTER DATABASE;Tom Lane2004-11-18
| | | | | | | | 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.
* Prevent a backend crash when processing CREATE TABLE commands withNeil Conway2004-11-16
| | | | | | | | 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.
* There is no need for ReadBuffer() call sites to check that the returnedNeil Conway2004-11-14
| | | | | | 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.
* When implementing a coercion to a domain type with a combinedTom Lane2004-11-06
| | | | | | 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).
* Create 'default_tablespace' GUC variable that supplies a TABLESPACETom Lane2004-11-05
| | | | | | | | | | 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.
* Small message clarificationsPeter Eisentraut2004-11-05
|
* I found a corner case in which it is possible for RI_FKey_check's callTom Lane2004-10-30
| | | | | | | | | | | | | | 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.
* Fix failure to think clearly about encoding conversion errors in COPY.Tom Lane2004-10-29
| | | | | | | | | 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.
* On Windows, force a checkpoint just before dropping a database's physicalTom Lane2004-10-28
| | | | | | 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.
* Make heap_fetch API more consistent by having the buffer remain pinnedTom Lane2004-10-26
| | | | | | 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.
* In the new dispensation where REINDEX doesn't take exclusive lock onTom Lane2004-10-25
| | | | | the parent table, it's essential that all index accesses take some kind of lock on the index. I had missed vacuumlazy.c :-( ...
* Modify hash_create() to elog(ERROR) if an error occurs, rather thanNeil Conway2004-10-25
| | | | | | | | 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().
* In ALTER COLUMN TYPE, strip any implicit coercion operations appearingTom Lane2004-10-22
| | | | | | 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.
* Disallow referential integrity actions from being deferred; only theTom Lane2004-10-21
| | | | | | | | 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.
* Give a more user-friendly error message in situation where CREATE DATABASETom Lane2004-10-17
| | | | | | | 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.
* Give a more user-friendly error message in case where a table is createdTom Lane2004-10-16
| | | | in a schema whose default tablespace has been dropped.
* Repair possible failure to update hint bits back to disk, perTom Lane2004-10-15
| | | | | | | | | | 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.
* Message style revisionsPeter Eisentraut2004-10-12
|
* Adjust comments previously moved to column 1 by pgident.Bruce Momjian2004-10-07
|
* Back out unindented modification to file.Bruce Momjian2004-10-07
|
* Indent comment pushed to new line by else so it is indented by BSDBruce Momjian2004-10-07
| | | | indent.
* Adjust index locking rules as per my proposal of earlier today. YouTom Lane2004-09-30
| | | | | | 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.
* Remove unnecessary use of index_open just to get the index name.Tom Lane2004-09-30
|
* Code cleanup: don't bother casting the argument to pfree() to void *Neil Conway2004-09-27
| | | | | from another pointer type. Per C89, this is unnecessary, and it is common practice throughout the rest of the tree anyway.
* GUC assign hooks that look at external state in deciding whether aTom Lane2004-09-24
| | | | | | | 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.
* Fix ALTER TABLE OWNER to adjust the ownership of dependent sequences,Tom Lane2004-09-23
| | | | not only indexes. Alvaro Herrera, with some kibitzing by Tom Lane.
* Restructure subtransaction handling to reduce resource consumption,Tom Lane2004-09-16
| | | | | | | | | | | | | | | | | 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.
* Redesign query-snapshot timing so that volatile functions in READ COMMITTEDTom Lane2004-09-13
| | | | | | | | | | | | | 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.
* Renumber SnapshotNow and the other special snapshot codes so thatTom Lane2004-09-11
| | | | | | | | ((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.
* Fire non-deferred AFTER triggers immediately upon query completion,Tom Lane2004-09-10
| | | | | | | | | | | | | 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.
* Minor efficiency improvements in keeping track of trigger deferredTom Lane2004-09-08
| | | | | | | | 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.
* Fix a couple of small errors in trigger-list management, as per recentTom Lane2004-09-07
| | | | discussion.
* Fix a number of places where brittle data structures or overly strongTom Lane2004-09-06
| | | | | | | | | 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.
* Remove obsolete comment.Tom Lane2004-09-02
|
* needs_toast_table() should ignore dropped columns.Tom Lane2004-08-31
|
* Code review for various recent GUC hacking. Don't elog(ERROR) whenTom Lane2004-08-31
| | | | | | | 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.
* copy_relation_data was mistakenly assuming that the source relationTom Lane2004-08-31
| | | | | would always be already open at the smgr level. Per bug report from Fabien Coelho.
* Dept. of second thoughts: it'd be a good idea to flush buffersTom Lane2004-08-30
| | | | | | | | 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.
* Another pgindent run with lib typedefs added.Bruce Momjian2004-08-30
|
* Add WAL logging for CREATE/DROP DATABASE and CREATE/DROP TABLESPACE.Tom Lane2004-08-29
| | | | | | | | Fix TablespaceCreateDbspace() to be able to create a dummy directory in place of a dropped tablespace's symlink. This eliminates the open problem of a PANIC during WAL replay when a replayed action attempts to touch a file in a since-deleted tablespace. It also makes for a significant improvement in the usability of PITR replay.
* Pgindent run for 8.0.Bruce Momjian2004-08-29
|
* Update copyright to 2004.Bruce Momjian2004-08-29
|
* Rearrange order of operations in heap_drop_with_catalog and index_dropTom Lane2004-08-28
| | | | | | | | | | so that we close and flush the doomed relation's relcache entry before we start to delete the underlying catalog rows, rather than afterwards. For awhile yesterday I thought that an unexpected relcache entry rebuild partway through this sequence might explain the infrequent parallel regression failures we were chasing. It doesn't, mainly because there's no CommandCounterIncrement in the sequence and so the deletions aren't "really" done yet. But it sure seems like trouble waiting to happen.
* Rearrange pg_subtrans handling as per recent discussion. pg_subtransTom Lane2004-08-23
| | | | | | | updates are no longer WAL-logged nor even fsync'd; we do not need to, since after a crash no old pg_subtrans data is needed again. We truncate pg_subtrans to RecentGlobalXmin at each checkpoint. slru.c's API is refactored a little bit to separate out the necessary decisions.
* Code review for ALTER INDEX patch.Tom Lane2004-08-22
|
* Dept. of further reflection: I looked around to see if any other callersTom Lane2004-08-15
| | | | | | | | | | | | of XLogInsert had the same sort of checkpoint interlock problem as RecordTransactionCommit, and indeed I found some. Btree index build and ALTER TABLE SET TABLESPACE write data outside the friendly confines of the buffer manager, and therefore they have to take their own responsibility for checkpoint interlock. The easiest solution seems to be to force smgrimmedsync at the end of the index build or table copy, even when the operation is being WAL-logged. This is sufficient since the new index or table will be of interest to no one if we don't get as far as committing the current transaction.
* Change order of operations in ALTER TABLE SET TABLESPACE so that weTom Lane2004-08-13
| | | | | | don't hold an open file reference to the original table at the end. This is a good thing in any case, particularly so on Windows which cannot drop the table file otherwise.