Re: returning CHAR from C function

From: Joe Conway <mail(at)joeconway(dot)com>
To: elein(at)varlena(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: returning CHAR from C function
Date: 2002-11-30 23:46:42
Message-ID: 3DE94DE2.6020903@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2002-11-30 23:56:39 Re: returning CHAR from C function
Previous Message ow 2002-11-30 23:39:48 Re: 7.4 Wishlist