Re: latest plperl

From: Joe Conway <mail(at)joeconway(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org, plperlng-devel(at)pgfoundry(dot)org
Subject: Re: latest plperl
Date: 2004-07-01 16:06:56
Message-ID: 40E436A0.5040207@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

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

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Joe Conway 2004-07-01 16:33:57 Re: latest plperl
Previous Message Andrew Dunstan 2004-07-01 15:28:19 Re: [Plperlng-devel] Re: latest plperl