On Wed, May 26, 2004 at 04:35:52PM -0700, Stephan Szabo wrote: > On Wed, 26 May 2004, Alvaro Herrera wrote: > > > I'm missing one item: deferred triggers. The problem with this is that > > the deftrig queue is not implemented using normal Lists, so there's no > > efficient way to reassign to the parent when the subtransaction commits. > > Also I'm not sure what should happen to the "immediate" pointer --- a > > subtransaction should have it's own private copy, or it should inherit > > the parent's? Please whoever implemented this speak up (Stephan > > Szabo?), as I'm not sure of the semantics. > > The immediate pointer basically points at the end of the queue from the > last scanning of the trigger queue (since any "immediate" triggers from > before that would have been run at that time there's no reason to scan > from the beginning).
Hmm. You assume correctly that a subtransaction has (or will have) a private queue. But we do not consider a subtransaction to be somewhat a separate entity -- the principle is that the transaction has to feel just like the BEGIN wasn't there. So BEGIN; UPDATE foo ... UPDATE bar ... COMMIT has to be exactly the same as BEGIN; BEGIN; UPDATE foo ... COMMIT; BEGIN; UPDATE bar ... COMMIT; COMMIT; Now, with that in mind: is it correct that the "immediate" pointer points to the beginning of the subtransaction's private deferred trigger queue, at subtransaction's start? Now, at subtransaction end, lets suppose I concatenate the list the original transaction had with the subtransaction's private list. What should the immediate pointer be? When is the immediate pointer advanced? I know it's "during scanning of the list", but when is this? At the end of each query? > If one sets a constraint to immediate in a subtransaction, does/should > it cause the immediate check of pending events from its parent? And > does that revert when the transaction ends? Yes, I think it should fire all events, including the parent's. Good point; it means there has to be a way of getting the whole list, from the topmost transaction, in order :-( I'm not sure what you mean by reverting though. -- Alvaro Herrera (<alvherre[a]dcc.uchile.cl>) La web junta la gente porque no importa que clase de mutante sexual seas, tienes millones de posibles parejas. Pon "buscar gente que tengan sexo con ciervos incendiánse", y el computador dirá "especifique el tipo de ciervo" (Jason Alexander) ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])