Skip site navigation (1) Skip section navigation (2)

Re: text(bool), text(numeric)

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Vicktor <vic(at)adv(dot)ru>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: text(bool), text(numeric)
Date: 2001-11-28 16:35:00
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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
 create function text(numeric) returns text as 'select
textin(numericout($1));' language 'sql';

In response to


pgsql-bugs by date

Next:From: VicktorDate: 2001-11-28 17:30:05
Subject: Re: text(bool), text(numeric)
Previous:From: Markus BertheauDate: 2001-11-28 13:49:34
Subject: Re: Bug report.

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group