Re: trigger AFTER INSERT
Re: trigger AFTER INSERT
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Josi Perez (3T Systems)" writes: > If I write a trigger AFTER INSERT and I have one error in this trigger, the > record (that I think was already inserted) is not inserted. Sure, because the whole transaction is rolled back on error. regards, tom lane
Re: trigger AFTER INSERT
От:
"Kevin Grittner" <Kevin.Grittner@wicourts.gov>
Дата:
"Josi Perez (3T Systems)" wrote: > Without considering the errors, the transaction should not start > after the AFTER INSERT? Anything happening in a trigger is always part of the same database transaction as the database action which fired the trigger. -Kevin
Re: trigger AFTER INSERT
От:
"Josi Perez (3T Systems)" <josiperez3t@gmail.com>
Дата:
Thank you for your answer.
Without considering the errors, the transaction should not start after the AFTER INSERT?
Josi Perez
Without considering the errors, the transaction should not start after the AFTER INSERT?
Josi Perez
2010/8/12 Tom Lane <tgl@sss.pgh.pa.us>
"Josi Perez (3T Systems)" <josiperez3t@gmail.com> writes:Sure, because the whole transaction is rolled back on error.
> If I write a trigger AFTER INSERT and I have one error in this trigger, the
> record (that I think was already inserted) is not inserted.
regards, tom lane
trigger AFTER INSERT
От:
"Josi Perez (3T Systems)" <josiperez3t@gmail.com>
Дата:
Hi,
I think that I have a conceptual problem and I hope anyone could help me.
If I write a trigger AFTER INSERT and I have one error in this trigger, the record (that I think was already inserted) is not inserted.
Example:
INSERT INTO tableX <record1>
trigger sumRecords AFTER INSERT under tableX to accumulate the records inserted by hour
if there is an error in the commands executed for this record, <record1> is not in the tableX
If this occurs in a trigger BEFORE INSERT, I can understand, but, if it is AFTER INSERT, I believe that the record is already inserted.
What is wrong on it?
Thanks in advance
Josi Perez
I think that I have a conceptual problem and I hope anyone could help me.
If I write a trigger AFTER INSERT and I have one error in this trigger, the record (that I think was already inserted) is not inserted.
Example:
INSERT INTO tableX <record1>
trigger sumRecords AFTER INSERT under tableX to accumulate the records inserted by hour
if there is an error in the commands executed for this record, <record1> is not in the tableX
If this occurs in a trigger BEFORE INSERT, I can understand, but, if it is AFTER INSERT, I believe that the record is already inserted.
What is wrong on it?
Thanks in advance
Josi Perez