Re: text(bool), text(numeric) - Mailing list pgsql-bugs

From Stephan Szabo
Subject Re: text(bool), text(numeric)
Date
Msg-id 20011128082654.T32047-100000@megazone23.bigpanda.com
Whole thread Raw
In response to text(bool), text(numeric)  (Vicktor <vic@adv.ru>)
Responses Re: text(bool), text(numeric)
List pgsql-bugs
On Wed, 28 Nov 2001, Vicktor wrote:

> Hello All,
>
>  Why not exists functions for convert any type to text?
>  I can't find text(bool), text(numeric) ...
>  May be it posiible in 7.2?

Don't think so.  You need those functions and noone has written
them officially.

The former is easy, something like:

create function text(bool) returns text as 'select case when $1 then
''true'' else ''false'' end;' language 'sql';

should suffice.


I'm not entirely sure this is entirely safe for the latter, but you can
try :)

 create function numericout(numeric) returns int as 'numeric_out' language
'internal';
 create function text(numeric) returns text as 'select
textin(numericout($1));' language 'sql';

pgsql-bugs by date:

Previous
From: Markus Bertheau
Date:
Subject: Re: Bug report.
Next
From: Vicktor
Date:
Subject: Re: text(bool), text(numeric)