| 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: UDFs |
| Date: | 2007-08-13 08:42:52 |
| Message-ID: | 20070813084252.GB7252@svana.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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 <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | John Coulthard | 2007-08-13 09:05:54 | Re: Unable to connect to PostgreSQL server via PHP |
| Previous Message | Pavel Stehule | 2007-08-13 08:39:17 | Re: UDFs |