Re: Fix disabled triggers with deferred constraints
От | Gavin Sherry |
---|---|
Тема | Re: Fix disabled triggers with deferred constraints |
Дата | |
Msg-id | Pine.LNX.4.21.0208131342460.22771-100000@linuxworld.com.au обсуждение исходный текст |
Ответ на | Re: Fix disabled triggers with deferred constraints (Neil Conway <nconway@klamath.dyndns.org>) |
Ответы |
Re: Fix disabled triggers with deferred constraints
|
Список | pgsql-patches |
On 7 Aug 2002, Neil Conway wrote: > Tom Lane <tgl@sss.pgh.pa.us> writes: > > Neil Conway <nconway@klamath.dyndns.org> writes: > > > Elliot Lee <sopwith@redhat.com> writes: > > > I remember looking at this issue and not doing anything because I > > > couldn't decide whether the test for enabled status should occur when > > > the trigger is queued or when it is executed --- or, perhaps, both? > > > Is there anything in the standard about it? > > [...] > > > I think we're still waiting for someone to figure out what the behavior > > should be per spec. > > I took a brief look at SQL99, but I couldn't find anything regarding > this issue (AFAICS it doesn't mention "disabled triggers" at all). But > given my prior track record for divining information from the > standards, perhaps someone should double-check :-) I had a pretty hard look around SQL99. It does not appear to say anything explicit about disabling triggers. This should be clear from page 90: 4.35 Triggers. This specifies the trigger descriptor. Those familiar with SQL99 know that it just about mandates that all state information about any object in the system is recorded in its descriptor. The fact that enabled/disabled state information is not recorded in the trigger descriptor suggests that it is only ever enabled. More over there is no case when a trigger is not executed, according to 10.12 'Execution of triggers'. I dug deeper, wondering if it may be implicitly disabled given the disabling of its 'dependencies', shall we call them. Namely: the base table or the procedure used in the trigger action. Tables cannot be disabled or made in active. As for the procedure, <SQL procedure statement>, this expands to SQL which, itself, cannot be 'disabled'. The spec is a large one and I didn't look at all references to triggers -- since there are hundreds -- but I don't believe that there is any precedent for an implementation of DISABLE TRIGGER. FWIW, i think that in the case of deferred triggers they should all be added to the queue and whether they are executed or not should be evaluated inside DeferredTriggerExecute() with: if(LocTriggerData.tg_trigger->tgenabled == false) return; Gavin
В списке pgsql-patches по дате отправления: