Jan Wieck JanWieck at Yahoo.com
Wed May 19 21:41:54 PDT 2010
On 5/20/2010 11:33 AM, Jeff wrote:
> it happened again - wanted to get this post out before I do more  
> digging:
> 
> table summary as an on delete cascade FK into sourcereports.
> we delete from sourcereports.
> the RI trigger deletes from summary (5700) but does not fire the log  
> trigger yet.
> we go on our merry way nuking events.
> then my summary update trigger runs - the delete inside it does  
> nothing due to the FK already nuking the row then proceeds to insert  
> into it.
> then we execute the slon logger for the original FK delete and it  
> records a delete record after the insert.

Does summary also have an FK with cascade referencing sourcereport?

The thing that I don't understand is where the insert into summary is 
actually coming from. The trigger does

     insert into summary (...) select ... from sourcereport
         where sourceid = <just_deleted_id>

Since it is an AFTER trigger, the result set of that select should be 
empty and no row get inserted.

This still does not explain the wrong ordering of the log rows, but I'm 
getting a better picture of it.


Jan


> 
> then someone comes along and loads a new report for the same sourceid  
> (to avoid confusion, it is a company identifier)
> 
> I need to flesh this out a bit more but I think it is related, I'll  
> report back in a bit with more details.
> 
> 
> --
> Jeff Trout <jeff at jefftrout.com>
> http://www.stuarthamm.net/
> http://www.dellsmartexitin.com/
> 
> 


-- 
Anyone who trades liberty for security deserves neither
liberty nor security. -- Benjamin Franklin


More information about the Slony1-general mailing list