Re: Bug #894: different result with the same parameterlist in function call

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Bug #894: different result with the same parameterlist in function call
Дата
Msg-id 1603.1044812036@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Bug #894: different result with the same parameterlist in function call  (pgsql-bugs@postgresql.org)
Список pgsql-bugs
pgsql-bugs@postgresql.org writes:
>  text *pattern = (text*)PG_GETARG_TEXT_P(0);
>  text *sample = (text*)PG_GETARG_TEXT_P(1);
>  char *char_pattern = (char*)VARDATA(pattern);
>  char *char_sample = (char*)VARDATA(sample);

You can't convert text* to char* with just a cast.  The result won't
(usually) be null-terminated where it should be; so you end up with
strings that have garbage on the end.  Use textout() like all the
existing code does when it wants a null-terminated string.

            regards, tom lane

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

Предыдущее
От: pgsql-bugs@postgresql.org
Дата:
Сообщение: Bug #894: different result with the same parameterlist in function call
Следующее
От: "Donald Fraser"
Дата:
Сообщение: Re: Trigger function not executing