On Mon, Aug 13, 2007 at 03:17:36PM +0000, jf wrote:
> Hi.
> 
> Trying to implement some simple digest routines via UDFs and for whatever
> reason I get: ERROR:  invalid memory alloc request size 4294967293 on
> PG_RETURN_TEXT_P(); any ideas what the issue is exactly?

A few points about your code:
- The tests against NULL are useless: palloc never returns NULL and
the argument to the function won't be NULL either (it's decalred
STRICT).
- Your palloc should be for more, the header may be more than one byte
VAR_HEADER_LEN or some such would be more appropriate)
- Finally, what is probably the actual problem, at no point did you
assign a length to the hash variable, ie VARLEN(hash)=foo.

Hope this helps,
-- 
Martijn van Oosterhout   <[EMAIL PROTECTED]>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to 
> litigate.

Attachment: signature.asc
Description: Digital signature

Reply via email to