Re: returning CHAR from C function

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: returning CHAR from C function
Дата
Msg-id 3DE94DE2.6020903@joeconway.com
обсуждение исходный текст
Ответ на returning CHAR from C function  (elein <elein@sbcglobal.net>)
Ответы Re: returning CHAR from C function  (Joe Conway <mail@joeconway.com>)
Список pgsql-general
elein wrote:
> create function retchar(text)
> returns char
> as '$libdir/retchar.so'
> language 'c';
>

I get similar results.

It looks like the cause is that in the create function statement above the
"returns char" is interpreted as returning type 1042 (==bpchar), instead of
type 18 (==char), which is what you need (and intended). I'm not sure what the
proper way to define a function returning type char is, but I did this:

regression=# update pg_proc set prorettype = 18 where proname = 'retchar';
UPDATE 1
regression=# select retchar('abc');
  retchar
---------
  a
(1 row)

then the function works fine :-)

Joe



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

Предыдущее
От: elein
Дата:
Сообщение: returning CHAR from C function
Следующее
От: Joe Conway
Дата:
Сообщение: Re: returning CHAR from C function