Thread: Transaction
An event triggers a rule / trigger. Does this (event + rule/trigger) behave as a transaction, or is it necessary to wrap it into BEGIN COMMIT? If yes, BEGIN should be before or after the event (in the rule/trigger)?
On Mon, 17 Sep 2001, Mihai Gheorghiu wrote: > An event triggers a rule / trigger. > Does this (event + rule/trigger) behave as a transaction, or is it necessary > to wrap it into BEGIN COMMIT? If yes, BEGIN should be before or after the > event (in the rule/trigger)? The rule/trigger runs in the same transaction as the original statement (if you're not in an explicit transaction, you should get an implicit one around the statement automatically)
"Mihai Gheorghiu" <tanethq@earthlink.net> writes: > An event triggers a rule / trigger. > Does this (event + rule/trigger) behave as a transaction, or is it necessary > to wrap it into BEGIN COMMIT? If yes, BEGIN should be before or after the > event (in the rule/trigger)? It is always inside a transaction, since every SQL statement is a transaction (unless of course you use BEGIN/COMMIT explicitly). So "event + trigger" will succeed or fail atomically. -Doug -- In a world of steel-eyed death, and men who are fighting to be warm, Come in, she said, I'll give you shelter from the storm. -Dylan
"Mihai Gheorghiu" wrote: >An event triggers a rule / trigger. >Does this (event + rule/trigger) behave as a transaction, or is it necessary >to wrap it into BEGIN...COMMIT? If yes, BEGIN should be before or after the >event (in the rule/trigger)? Any single command is a transaction including all its effects, unless it is part of a larger transaction delimited by BEGIN COMMIT. It doesn't need its own BEGIN...COMMIT. -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight http://www.lfix.co.uk/oliver PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47 GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "Honour the LORD with thy substance, and with the firstfruits of all thine increase; So shall thy barns be filled with plenty, and thy presses shall burst out with new wine." Proverbs 3:9,10