Re: Better support for whole-row operations and composite - Mailing list pgsql-hackers

From Joe Conway
Subject Re: Better support for whole-row operations and composite
Date
Msg-id 406F8E38.9030302@joeconway.com
Whole thread Raw
In response to Re: Better support for whole-row operations and composite types  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:

> Joe Conway <mail@joeconway.com> writes:
> 
>>For triggers, I was previously building up the arguments thus:
>>     slot = TupleDescGetSlot(tupdesc);
>>     slot->val = trigdata->tg_trigtuple;
>>     arg[7] = PointerGetDatum(slot);
> 
> 
>>I suppose now I should do this instead?
>>     arg[7] = PointerGetDatum(trigdata->tg_trigtuple->t_data);
> 
> 
> Hm, no, that won't work because a tuple being passed to a trigger
> probably isn't going to contain valid type information.  The API for
> calling triggers is different from calling ordinary functions, so
> I never thought about trying to make it look the same.  At what point
> are you trying to do the above, anyway?

That's a shame -- it used to work fine -- done this way so the same 
function could handle tuple arguments to regular functions, and old/new 
tuples to trigger functions. It is in plr_trigger_handler(); vaguely 
similar to pltcl_trigger_handler(). I'll have to figure out a workaround 
I guess.

Joe



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Better support for whole-row operations and composite
Next
From: Tom Lane
Date:
Subject: Re: Function to kill backend