aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/trigger.c
Commit message (Collapse)AuthorAge
...
* 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.
* 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.
* 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.
* 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.
* Pgindent run for 8.0.Bruce Momjian2004-08-29
|
* Update copyright to 2004.Bruce Momjian2004-08-29
|
* Nested transactions. There is still much left to do, especially on theTom Lane2004-07-01
| | | | | | | performance front, but with feature freeze upon us I think it's time to drive a stake in the ground and say that this will be in 7.5. Alvaro Herrera, with some help from Tom Lane.
* Reimplement the linked list data structure used throughout the backend.Neil Conway2004-05-26
| | | | | | | | | | | | | | | | In the past, we used a 'Lispy' linked list implementation: a "list" was merely a pointer to the head node of the list. The problem with that design is that it makes lappend() and length() linear time. This patch fixes that problem (and others) by maintaining a count of the list length and a pointer to the tail node along with each head node pointer. A "list" is now a pointer to a structure containing some meta-data about the list; the head and tail pointers in that structure refer to ListCell structures that maintain the actual linked list of nodes. The function names of the list API have also been changed to, I hope, be more logically consistent. By default, the old function names are still available; they will be disabled-by-default once the rest of the tree has been updated to use the new API names.
* Restructure smgr API as per recent proposal. smgr no longer depends onTom Lane2004-02-10
| | | | | | | | | the relcache, and so the notion of 'blind write' is gone. This should improve efficiency in bgwriter and background checkpoint processes. Internal restructuring in md.c to remove the not-very-useful array of MdfdVec objects --- might as well just use pointers. Also remove the long-dead 'persistent main memory' storage manager (mm.c), since it seems quite unlikely to ever get resurrected.
* $Header: -> $PostgreSQL Changes ...PostgreSQL Daemon2003-11-29
|
* Cross-data-type comparisons are now indexable by btrees, pursuant to myTom Lane2003-11-12
| | | | | | | | | | pghackers proposal of 8-Nov. All the existing cross-type comparison operators (int2/int4/int8 and float4/float8) have appropriate support. The original proposal of storing the right-hand-side datatype as part of the primary key for pg_amop and pg_amproc got modified a bit in the event; it is easier to store zero as the 'default' case and only store a nonzero when the operator is actually cross-type. Along the way, remove the long-since-defunct bigbox_ops operator class.
* Add operator strategy and comparison-value datatype fields to ScanKey.Tom Lane2003-11-09
| | | | | | | | | | | Remove the 'strategy map' code, which was a large amount of mechanism that no longer had any use except reverse-mapping from procedure OID to strategy number. Passing the strategy number to the index AM in the first place is simpler and faster. This is a preliminary step in planned support for cross-datatype index operations. I'm committing it now since the ScanKeyEntryInitialize() API change touches quite a lot of files, and I want to commit those changes before the tree drifts under me.
* Implement isolation levels read uncommitted and repeatable read as actingPeter Eisentraut2003-11-06
| | | | like the next higher one.
* Change some notices to warnings and vice versa according to criteriaPeter Eisentraut2003-10-02
| | | | developed on -hackers.
* Get rid of ReferentialIntegritySnapshotOverride by extending Executor APITom Lane2003-09-25
| | | | | | to allow es_snapshot to be set to SnapshotNow rather than a query snapshot. This solves a bug reported by Wade Klaver, wherein triggers fired as a result of RI cascade updates could misbehave.
* Message editing: remove gratuitous variations in message wording, standardizePeter Eisentraut2003-09-25
| | | | | terms, add some clarifications, fix some untranslatable attempts at dynamic message building.
* Another pgindent run with updated typedefs.Bruce Momjian2003-08-08
|
* Update copyrights to 2003.Bruce Momjian2003-08-04
|
* pgindent run.Bruce Momjian2003-08-04
|
* Adjust 'permission denied' messages to be more useful and consistent.Tom Lane2003-08-01
|
* A visit from the message-style police ...Tom Lane2003-07-28
|
* Another round of error message editing, covering backend/commands/.Tom Lane2003-07-20
|
* Some early work on error message editing. Operator-not-found andTom Lane2003-07-04
| | | | | function-not-found messages now distinguish the cases no-match and ambiguous-match, and they follow the style guidelines too.
* In an attempt to simplify my life I'm submitting this patch thatBruce Momjian2003-06-24
| | | | | | | | restructures the deferred trigger queue. The fundamental change is to put all the static variables to hold the deferred triggers in a single structure. Alvaro Herrera
* Avoid O(N^2) behavior with lots of deferred triggers by makingTom Lane2003-04-20
| | | | | deferredTriggerInvokeEvents only scan events added since it last ran. Stephan Szabo, some corrections by Tom Lane.
* The following patch cleans up the deferred trigger mechanism. There isBruce Momjian2003-03-31
| | | | | | | | | an unneeded memory context and some variables that are not used anymore. It's pretty trivial and the regression tests pass fine. There's no change in functionality, only deletion of unused code. I left an empty function because maybe I'll need it for nested transactions. Alvaro Herrera
* GetTupleForTrigger must use outer transaction's command counter for timeTom Lane2003-03-27
| | | | qual checking, not GetCurrentCommandId. Per test case from Steve Wolfe.
* Create a distinction between Lists of integers and Lists of OIDs, to getTom Lane2003-02-09
| | | | | | rid of the assumption that sizeof(Oid)==sizeof(int). This is one small step towards someday supporting 8-byte OIDs. For the moment, it doesn't do much except get rid of a lot of unsightly casts.
* Updated deferred trigger patch.Bruce Momjian2003-01-08
| | | | Neil Conway
* This trivial patch implements disabled, deferred triggers, per myBruce Momjian2003-01-08
| | | | | | | | | | | | | proposal on -hackers a couple days ago. The 'tgenabled' status of the trigger is consulted when the trigger is added to the deferred queue (i.e. when the event occurs that fires the trigger), not when the deferred event is executed. No regression tests, as another bug prevents them (the pg_trigger row for a trigger is only loaded once per session, so any changes to it are not noticed unless the client disconnects and reconnects). Neil Conway
* Tweak default memory context allocation policy so that a context is notTom Lane2002-12-15
| | | | | | | | | given any malloc block until something is first allocated in it; but thereafter, MemoryContextReset won't release that first malloc block. This preserves the quick-reset property of the original policy, without forcing 8K to be allocated to every context whether any of it is ever used or not. Also, remove some more no-longer-needed explicit freeing during ExecEndPlan.
* Un-break triggers declared for INSERT OR DELETE OR UPDATE. This workedTom Lane2002-11-25
| | | | | okay in 7.3, so I think it must have been busted in the recent triggers patch.
* This patch implements FOR EACH STATEMENT triggers, per my email toBruce Momjian2002-11-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -hackers a couple days ago. Notes/caveats: - added regression tests for the new functionality, all regression tests pass on my machine - added pg_dump support - updated PL/PgSQL to support per-statement triggers; didn't look at the other procedural languages. - there's (even) more code duplication in trigger.c than there was previously. Any suggestions on how to refactor the ExecXXXTriggers() functions to reuse more code would be welcome -- I took a brief look at it, but couldn't see an easy way to do it (there are several subtly-different versions of the code in question) - updated the documentation. I also took the liberty of removing a big chunk of duplicated syntax documentation in the Programmer's Guide on triggers, and moving that information to the CREATE TRIGGER reference page. - I also included some spelling fixes and similar small cleanups I noticed while making the changes. If you'd like me to split those into a separate patch, let me know. Neil Conway
* Add new palloc0 call as merge of palloc and MemSet(0).Bruce Momjian2002-11-13
|
* Back out use of palloc0 in place if palloc/MemSet. Seems constant lenBruce Momjian2002-11-11
| | | | to MemSet is a performance boost.
* Merge palloc()/MemSet(0) calls into a single palloc0() call.Bruce Momjian2002-11-10
|
* Avoid using IsTransactionBlock() in DeferredTriggerSetState(); no realTom Lane2002-10-21
| | | | need for this optimization, and it's too easily fooled anyway.
* Arrange to copy relcache's trigdesc structure at the start of anyTom Lane2002-10-14
| | | | | | | | | | | | query that uses it. This ensures that triggers will be applied consistently throughout a query even if someone commits changes to the relation's pg_class.reltriggers field meanwhile. Per crash report from Laurette Cisneros. While at it, simplify memory management in relcache.c, which no longer needs the old hack to try to keep trigger info in the same place over a relcache entry rebuild. (Should try to fix rd_att and rewrite-rule access similarly, someday.) And make RelationBuildTriggers simpler and more robust by making it build the trigdesc in working memory and then CopyTriggerDesc() into cache memory.
* Hack to make it possible to load CREATE CONSTRAINT TRIGGER commands thatTom Lane2002-10-03
| | | | | are missing the FROM clause (due to a long-ago pg_dump bug). Patch by Stephan Szabo, minor tweaking by Tom Lane.
* Further thinking about heap_mark4update: in HeapTupleSelfUpdated case,Tom Lane2002-09-23
| | | | | | | | | executor should not return the tuple as successfully marked, because in fact it's been deleted. Not clear that this case has ever been seen in practice (I think you'd have to write a SELECT FOR UPDATE that calls a function that deletes some row the SELECT will visit later...) but we should be consistent. Also add comments to several other places that got it right but didn't explain what they were doing.
* Provide an upgrade strategy for dump files containing functions declaredTom Lane2002-09-21
| | | | | | | | with OPAQUE. CREATE LANGUAGE, CREATE TRIGGER, and CREATE TYPE will all accept references to functions declared with OPAQUE --- but they will issue a NOTICE, and will modify the function entries in pg_proc to have the preferred type-safe argument or result types instead of OPAQUE. Per recent pghackers discussions.
* pgindent run.Bruce Momjian2002-09-04
|
* Code review for HeapTupleHeader changes. Add version number to page headersTom Lane2002-09-02
| | | | | | | | | | (overlaying low byte of page size) and add HEAP_HASOID bit to t_infomask, per earlier discussion. Simplify scheme for overlaying fields in tuple header (no need for cmax to live in more than one place). Don't try to clear infomask status bits in tqual.c --- not safe to do it there. Don't try to force output table of a SELECT INTO to have OIDs, either. Get rid of unnecessarily complex three-state scheme for TupleDesc.tdhasoids, which has already caused one recent failure. Improve documentation.
* Clean up comments to be careful about the distinction between variable-Tom Lane2002-08-25
| | | | | | | | | | width types and varlena types, since with the introduction of CSTRING as a more-or-less-real type, these concepts aren't identical. I've tried to use varlena consistently to denote datatypes with typlen = -1, ie, they have a length word and are potentially TOASTable; while the term variable width covers both varlena and cstring (and, perhaps, someday other types with other rules for computing the actual width). No code changes in this commit except for renaming a couple macros.
* Add a bunch of pseudo-types to replace the behavior formerly associatedTom Lane2002-08-22
| | | | | | with OPAQUE, as per recent pghackers discussion. I still want to do some more work on the 'cstring' pseudo-type, but I'm going to commit the bulk of the changes now before the tree starts shifting under me ...
* Make CREATE CONSTRAINT TRIGGER check for REFERENCES privilege on bothPeter Eisentraut2002-08-18
| | | | master and slave tables.
* Improve documentation of trigger firing queue handling, cleanup.Bruce Momjian2002-08-17
| | | | Neil Conway