aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/trigger.c
Commit message (Collapse)AuthorAge
...
* 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
* Remove obsolete uses of lanispl. Only used in pg_dump now, but can bePeter Eisentraut2002-08-13
| | | | removed altogether if pg_dump doesn't need it anymore.
* Restructure system-catalog index updating logic. Instead of havingTom Lane2002-08-05
| | | | | | | | | hardwired lists of index names for each catalog, use the relcache's mechanism for caching lists of OIDs of indexes of any table. This reduces the common case of updating system catalog indexes to a single line, makes it much easier to add a new system index (in fact, you can now do so on-the-fly if you want to), and as a nice side benefit improves performance a little. Per recent pghackers discussion.
* Tweak CreateTrigger() so that the OID used in the name of anTom Lane2002-07-20
| | | | | RI_ConstraintTrigger is the same OID assigned to the pg_trigger row. This reduces consumption of OIDs and may ease debugging.
* oid is needed, it is added at the end of the struct (after the nullBruce Momjian2002-07-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bitmap, if present). Per Tom Lane's suggestion the information whether a tuple has an oid or not is carried in the tuple descriptor. For debugging reasons tdhasoid is of type char, not bool. There are predefined values for WITHOID, WITHOUTOID and UNDEFOID. This patch has been generated against a cvs snapshot from last week and I don't expect it to apply cleanly to current sources. While I post it here for public review, I'm working on a new version against a current snapshot. (There's been heavy activity recently; hope to catch up some day ...) This is a long patch; if it is too hard to swallow, I can provide it in smaller pieces: Part 1: Accessor macros Part 2: tdhasoid in TupDesc Part 3: Regression test Part 4: Parameter withoid to heap_addheader Part 5: Eliminate t_oid from HeapTupleHeader Part 2 is the most hairy part because of changes in the executor and even in the parser; the other parts are straightforward. Up to part 4 the patched postmaster stays binary compatible to databases created with an unpatched version. Part 5 is small (100 lines) and finally breaks compatibility. Manfred Koizar
* Second phase of committing Rod Taylor's pg_depend/pg_constraint patch.Tom Lane2002-07-12
| | | | | | | | | | | | pg_relcheck is gone; CHECK, UNIQUE, PRIMARY KEY, and FOREIGN KEY constraints all have real live entries in pg_constraint. pg_depend exists, and RESTRICT/CASCADE options work on most kinds of DROP; however, pg_depend is not yet very well populated with dependencies. (Most of the ones that are present at this point just replace formerly hardwired associations, such as the implicit drop of a relation's pg_type entry when the relation is dropped.) Need to add more logic to create dependency entries, improve pg_dump to dump constraints in place of indexes and triggers, and add some regression tests.
* Update copyright to 2002.Bruce Momjian2002-06-20
|
* Mark index entries "killed" when they are no longer visible to anyTom Lane2002-05-24
| | | | | | | | | | | | | | | transaction, so as to avoid returning them out of the index AM. Saves repeated heap_fetch operations on frequently-updated rows. Also detect queries on unique keys (equality to all columns of a unique index), and don't bother continuing scan once we have found first match. Killing is implemented in the btree and hash AMs, but not yet in rtree or gist, because there isn't an equally convenient place to do it in those AMs (the outer amgetnext routine can't do it without re-pinning the index page). Did some small cleanup on APIs of HeapTupleSatisfies, heap_fetch, and index_insert to make this a little easier.
* Remove global variable scanCommandId in favor of storing a command IDTom Lane2002-05-21
| | | | | | | | | | | in snapshots, per my proposal of a few days ago. Also, tweak heapam.c routines (heap_insert, heap_update, heap_delete, heap_mark4update) to be passed the command ID to use, instead of doing GetCurrentCommandID. For catalog updates they'll still get passed current command ID, but for updates generated from the main executor they'll get passed the command ID saved in the snapshot the query is using. This should fix some corner cases associated with functions and triggers that advance current command ID while an outer query is still in progress.
* Code review for ALTER TRIGGER RENAME patch: make better use of index,Tom Lane2002-04-30
| | | | don't scribble on tuple returned by table scan.