Re: selfmade datatype in C and server-crash

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: selfmade datatype in C and server-crash
Дата
Msg-id 18730.1128524360@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: selfmade datatype in C and server-crash  (Markus Schulz <msc@antzsystem.de>)
Список pgsql-general
Markus Schulz <msc@antzsystem.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Richard_D_Levine@raytheon.com
Дата:
Сообщение: Re: Securing Postgres
Следующее
От: "Welty, Richard"
Дата:
Сообщение: Re: Securing Postgres