Re: Problems with a C function, pg_uname(), and String concatenation.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Problems with a C function, pg_uname(), and String concatenation.
Дата
Msg-id 3265.1214921565@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Problems with a C function, pg_uname(), and String concatenation.  (Rafael Martinez <r.m.guerrero@usit.uio.no>)
Список pgsql-general
Rafael Martinez <r.m.guerrero@usit.uio.no> writes:
> We have a function in C which is accessed via a view and which produces
> a strange result when used together with || (String concatenation).
> I can not find the problem. Any C/postgres guru with any idea of how to
> fix it?

You need to set the size of the text result correctly.  As is, you're
returning a 252-byte result containing embedded nulls and random
garbage.  Embedded nulls, in particular, are verboten.

The fixed-size palloc is okay (as long as you're sure it's enough),
but the length word should only count valid data.

            regards, tom lane

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

Предыдущее
От: "Chandra ASGI Tech"
Дата:
Сообщение: Re: Need some help
Следующее
От: Felipe de Jesús Molina Bravo
Дата:
Сообщение: SRF written in C