Re: Casting to varchar
| От | Raymond O'Donnell |
|---|---|
| Тема | Re: Casting to varchar |
| Дата | |
| Msg-id | 463B9A9F.80008@iol.ie обсуждение исходный текст |
| Ответ на | Casting to varchar (Scott Ribe <scott_ribe@killerbytes.com>) |
| Ответы |
Re: Casting to varchar
|
| Список | pgsql-general |
On 04/05/2007 21:34, Scott Ribe wrote:
> Just discovered (the hard way) that casting a boolean column ::varchar
> doesn't work. I assume I can add a function somewhere that will define a
> default cast for this? Are there any other standard types that can't be cast
I just use something like this:
create or replace function bool2str(TheValue boolean)
returns varchar as
$$
begin
if TheValue then
return 'true';
else
return 'false';
end if;
end;
$$
language plpgsql stable;
Ray.
---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
---------------------------------------------------------------
В списке pgsql-general по дате отправления: