Talk:Database trigger

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Databases / Computer science   
WikiProject icon This article is within the scope of WikiProject Databases, a collaborative effort to improve the coverage of database related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
 ???  This article has not yet received a rating on the project's quality scale.
 ???  This article has not yet received a rating on the project's importance scale.
Taskforce icon
This article is supported by WikiProject Computer science.
 

Addition of Row/Statement Level Triggers[edit]

Row and statement level triggers are an important component of how triggers behave. I saw the article lacking explanation on this topic so I have adding examples of each combination(Before/Each Row, Before/Statement,After/Each Row, After/Statement). If you want to add addition examples in this topic and wish to stick with the same style I used, using a phone_book, send me a message and I can send you the .sql file. I have also noticed that the Database topic as a whole lacks a lot of components of the SQL language. When trying to put this wiki section together I noticed there is no coverage on SQL built in functions. I have cited an outside source showing a listing and describing some functions in SQL, nothing added to Wikipedia though. SQL functions would be a helpful and easy to put together resource. Hauschbc (talk)hauschbc

standards[edit]

Are triggers described by SQL93? What systems are compliant? Are these various features of various servers compliant or vendor extensions?

a musing[edit]

Imagine if a trigger was a method on an object.. When an object is modified, the trigger method is executed which then calls other objects and maintains invariants in the datastructure (garbage collection). Thus a trigger is nothing more than a precondition of a transaction to a database table (or an object).. However you like to look at it..

Some other languages have this, in the form of implied getters/setters or properties. API-wise, you think you're modifying public attributes; internally, you cause a getter or setter to be called, which has the option to make the requested change, throw an exception, make a different change, call additional code, etc. Two examples: Borland (CodeGear?)'s extended C++/VCL stuff lets you create properties on TObject descendants that look like simple variables but can optionall call getters and setters (doesn't have to be both), and in Javascript, the 'host' objects (window, XHR, etc.) exposed into JS may look like they have simple attributes, but on the other side of the API, there are actually getters/setters being called.Unordained (talk) 19:46, 30 April 2010 (UTC)

mutating table errors[edit]

We should add an explanation and an example for this problem. Additionally, it may be good to have some information on the behavior of different systems, i.e. can such errors occur or are they prevented. --Stolze 18:15, 19 November 2006 (UTC)

Microsoft SQL Server 'Inserted' and 'Deleted' Tables[edit]

After searching the internet for hours trying to figure out how to access data from the affected rows for conditional-trigger-logic, I stumbled upon MSDN's documentation of Inserted and Deleted tables, which store these values for the trigger incase it needs them. I added a small reference to these tables, but the comments I left could be worked over a little better.

I felt they were relevant here since it is mentioned that Triggers don't have parameters or arguments - thus the user should use the Inserted and Deleted tables for conditional-logic. —Preceding unsigned comment added by Sampsonvideos (talkcontribs) 19:24, 26 September 2007 (UTC)


No rollback of transactions via trigger?[edit]

According to the SQL documentation at least their server has the abilitiy to rollback transactions URL: http://msdn.microsoft.com/msdnmag/issues/03/12/DataPoints/ Can someone please check/clarify this? —Preceding unsigned comment added by 141.44.228.148 (talk) 15:08, 11 January 2008 (UTC)

Triggers in PostgreSQL[edit]

This section is a bit vague/confusing. You're left with the question so what triggers does PostgreSQL support? Lunchsure (talk) 20:27, 28 April 2008 (UTC) THATS —Preceding unsigned comment added by 81.28.124.159 (talk) 11:21, 1 November 2008 (UTC)

Postgresql does not support database level constraints[edit]

Removed the part where it says: "PostgreSQL's database-level constraints may perform a similar function to a TRANSACTION COMMIT trigger, though they are oriented toward detecting and preventing disallowed conditions, not performing arbitrary operations."

Because PostgreSQL does not have database-level constraints (CREATE ASSERTION) (if it does, please add a reference that backups that claim). —Preceding unsigned comment added by 201.155.6.245 (talk) 14:58, 31 March 2010 (UTC)

My mistake. I think I was remembering the ability to defer constraints (which may be limited to foreign key constraints at the moment?) and the ability to create deferred constraint triggers. You could probably hack something up, where all tables have triggers that cause one central table's deferred constraint trigger to fire, effectively giving you on-commit triggers, but that'd be a mess, and speculative, and therefore not worthy of the main article. Thanks for catching it.Unordained (talk) 19:20, 14 April 2010 (UTC)

Inconsistent Terminology[edit]

The article draws an implicit distinction between DDL triggers and DML triggers but then doesn't define DML (doesn't even cross-link to the Wikipedia article on DML). I've added this cross-link and made the distinction explicit.

Ross Fraser (talk) 16:36, 20 April 2010 (UTC)