Re: tg_trigtuple not NULL in AFTER STATEMENT triggers?

Lists: pgsql-hackers
From: Michael Fuhr <mike(at)fuhr(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: tg_trigtuple not NULL in AFTER STATEMENT triggers?
Date: 2006-07-31 14:24:58
Message-ID: 20060731142458.GA65794@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I've noticed that tg_trigtuple and tg_newtuple aren't cleared to
NULL in AFTER STATEMENT triggers. Is that an oversight, or does
the code intentionally not bother because trigger functions shouldn't
be referencing those members in statement-level triggers anyway, or
is there some other reason?

--
Michael Fuhr


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: tg_trigtuple not NULL in AFTER STATEMENT triggers?
Date: 2006-07-31 15:12:14
Message-ID: 20345.1154358734@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Michael Fuhr <mike(at)fuhr(dot)org> writes:
> I've noticed that tg_trigtuple and tg_newtuple aren't cleared to
> NULL in AFTER STATEMENT triggers. Is that an oversight,

Probably. Send a patch?

regards, tom lane


From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: tg_trigtuple not NULL in AFTER STATEMENT triggers?
Date: 2006-07-31 16:15:51
Message-ID: 20060731161551.GA66938@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Jul 31, 2006 at 11:12:14AM -0400, Tom Lane wrote:
> Michael Fuhr <mike(at)fuhr(dot)org> writes:
> > I've noticed that tg_trigtuple and tg_newtuple aren't cleared to
> > NULL in AFTER STATEMENT triggers. Is that an oversight,
>
> Probably. Send a patch?

Sure. Is the switch in AfterTriggerExecute() around line 2116 in
commands/trigger.c close to where I should be looking?

--
Michael Fuhr


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: tg_trigtuple not NULL in AFTER STATEMENT triggers?
Date: 2006-07-31 17:06:04
Message-ID: 25642.1154365564@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Michael Fuhr <mike(at)fuhr(dot)org> writes:
> On Mon, Jul 31, 2006 at 11:12:14AM -0400, Tom Lane wrote:
>> Michael Fuhr <mike(at)fuhr(dot)org> writes:
>>> I've noticed that tg_trigtuple and tg_newtuple aren't cleared to
>>> NULL in AFTER STATEMENT triggers. Is that an oversight,
>>
>> Probably. Send a patch?

> Sure. Is the switch in AfterTriggerExecute() around line 2116 in
> commands/trigger.c close to where I should be looking?

Yeah, it looks like some attention needs to be paid to whether
ate_oldctid and ate_newctid were supplied, rather than just blindly
passing pointers to possibly-uninitialized local structs.

Offhand I think you could remove the "switch" entirely in favor of
driving the setup of these fields off the "if (ItemPointerIsValid(..."
tests.

regards, tom lane