Re: UDFs

From: jf <jf(at)danglingpointers(dot)net>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: UDFs
Date: 2007-08-13 16:56:37
Message-ID: Pine.LNX.4.64.0708131654040.4503@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Yup, an uninitialized variable makes sense, That appears to have worked, I appreciate it. In regards to the checks for
NULL, I wasn't sure if it was necessary or not so I opted for the safe
route, thanks for clearing that up for me.

The output from the function is binary, does it matter if I use text or
bytea? Finally, how do I cast in SQL? when I try to pass the output to
encode() it says it can't find a function taking those types.

Thanks a lot!

On Mon, 13 Aug 2007, Martijn van Oosterhout wrote:

> Date: Mon, 13 Aug 2007 10:42:52 +0200
> From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
> To: jf <jf(at)danglingpointers(dot)net>
> Cc: pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] UDFs
>
> 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,
>

In response to

  • Re: UDFs at 2007-08-13 08:42:52 from Martijn van Oosterhout

Browse pgsql-general by date

  From Date Subject
Next Message Lim Berger 2007-08-13 16:59:07 Re: "Out of memory" errors..
Previous Message Lim Berger 2007-08-13 16:54:14 Re: "Out of memory" errors..