Re: Returning a char from a C-language function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "I(dot) B(dot)" <i(dot)bre(at)live(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Returning a char from a C-language function
Date: 2010-04-21 21:08:16
Message-ID: 15848.1271884096@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"I. B." <i(dot)bre(at)live(dot)com> writes:
> I have a small problem when trying to make a C-language function to return one character. The code is very simple and that's what's making it so strange.

> CREATE FUNCTION val(ibool)
> RETURNS char

You need to write "char", with the quotes. Without the quotes the type
name is taken as CHARACTER(1), ie what's internally called BpChar.
Totally different animal.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thom Brown 2010-04-21 21:24:57 Listing tables in all schemas in psql
Previous Message Mark Watson 2010-04-21 20:51:59 Re: Avoiding surrogate keys