Re: Plperl return_next and bytea binary data?

From: "Philippe Lang" <philippe(dot)lang(at)attiksystem(dot)ch>
To: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Plperl return_next and bytea binary data?
Date: 2006-07-25 06:43:00
Message-ID: 6C0CF58A187DA5479245E0830AF84F421D0F78@poweredge.attiksystem.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martijn van Oosterhout wrote:

> On Mon, Jul 24, 2006 at 11:43:39AM +0200, Philippe Lang wrote:
>> The problem seems to come from the return_next, in conjunction with
>> binary data:
>>
>> ------------------------------------
>> return_next
>> (
>> {
>> val => $_[0] * $_[1],
>> image => $im->gif()
>> }
>> );
>> ------------------------------------
>
> I don't know exact how pl/perl works, but given that it has
> no idea what type the data is, chances are it's passing it
> through cstring-to-text conversion. You probably want to
> force it to return bytea or some such (without going through
> cstring-to-bytea conversion hopefully). I don't see a way to
> do it in the documentation though...

Casting $im->gif() to bytea with $im->gif()::bytea does not help. It even makes things slightly worse: the image returned (ethereal sniff) is completely empty, where before it was filled with the first characters "GIF89ad" of the image.

Still searching...

Philippe

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2006-07-25 08:57:17 Re: sequences vs oids as primary keys
Previous Message Tom Lane 2006-07-25 04:19:17 Re: Does a GRANT on a table cascade/implied to its SEQUENCES