Andrew Dunstan wrote:
> Doh! Very bogus! sizeof(int)and a malloc to boot ???
>
> I didn't check the trigger code much because it has supposedly been working
> for quite a while. I will examine more closely.
Well, essentially 4 bytes (sizeof(int)) were being allocated to print a
two byte interger that can never be greater than two characters ("32"),
so I don't expect it would have ever failed, but only by serendipity.
>>Shouldn't that look more like this?
>>
>>+ plval = plperl_get_elem(hvNew, platt);
>>
>>+ if (plval)
>>+ {
>>+ modvalues[j] = FunctionCall3(&finfo,
>>+ CStringGetDatum(plval),
>>+ ObjectIdGetDatum(typelem),
>>+ Int32GetDatum(tupdesc->attrs[atti]->atttypmod)); +
>> modnulls[j] = ' ';
>>+ }
>>+ else
>>+ {
>>+ modvalues[i] = (Datum) 0;
>>+ modnulls[j] = 'n';
>>+ }
>>
>
> Yes, except that that [i] looks wrong too. Surely it should be [j]. And with
> this change decl of src appears redundant.
Hmmm, I missed that -- looks wrong to me too. I'll check it out.
> I will do some checking on these changes, but with those caveats they look
> good to me.
>
> Do you need a revised patch?
Nah, I'll make the changes and post a revised patch for you to comment
on prior to committing.
Joe