From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Markus Schulz <msc(at)antzsystem(dot)de> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: selfmade datatype in C and server-crash |
Date: | 2005-10-05 14:59:20 |
Message-ID: | 18730.1128524360@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Markus Schulz <msc(at)antzsystem(dot)de> writes:
> here is the etextin code:(cut'n'paste from adt/varlena.c Code)
> Datum
> etextin(PG_FUNCTION_ARGS)
> {
> char *inputText = PG_GETARG_CSTRING(0);
> text *result;
> int len=0;
> /* verify encoding */
> len = strlen(inputText);
> pg_verifymbstr(inputText, len, false);
> result = (text *) palloc(len + VARHDRSZ);
> VARATT_SIZEP(result) = len + VARHDRSZ;
> memcpy(VARDATA(result), inputText, len);
> PG_RETURN_TEXT_P(result);
> }
That code looks fine as far as it goes. I think you forgot to add a
PG_FUNCTION_INFO_V1() macro; which means the system is calling this with
the wrong argument layout.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Richard_D_Levine | 2005-10-05 14:59:46 | Re: Securing Postgres |
Previous Message | Richard Huxton | 2005-10-05 14:59:11 | Re: Securing Postgres |