Re: [SQL] Howto convert floats to text?

From: José Soares <jose(at)sferacarta(dot)com>
To: Martin Leja <martin(at)unix-ag(dot)org>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] Howto convert floats to text?
Date: 1999-06-04 12:51:35
Message-ID: 3757CBD7.66FBE889@sferacarta.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Use this PL/pgSQL script to create text(float), varchar(float), char(float):

create function "varchar"(float) returns varchar as
'begin
return $1;
end;
' language 'plpgsql';

create function bpchar(float) returns bpchar as
'begin
return $1;
end;
' language 'plpgsql';

create function text(float) returns text as
'begin
return $1;
end;
' language 'plpgsql';

create function float_text(float) returns text as
'
select text($1);
' language 'sql';

Martin Leja ha scritto:

> Hi,
>
> there are the following functions to convert types other than text to text:
>
> $bash psql -c "\df" | sed -n '1,2 p; /^text.*convert/ p'
>
> return_type|function |arguments |description
>
> -----------+------------------+--------------------+------------------------
> ----
> text |datetime_text |datetime |convert
>
> text |int2_text |int2 |convert
>
> text |int4_text |int4 |convert
>
> text |oid_text |oid |convert
>
> text |text |datetime |convert
>
> text |text |timespan |convert
>
> text |text |int4 |convert
>
> text |text |int2 |convert
>
> text |text |oid |convert
>
> text |timespan_text |timespan |convert
>
>
> is there realy no function to convert a float to text?
>
> --
> Regards, martin(at)unix-ag(dot)org

--
______________________________________________________________
PostgreSQL 6.5.0 on i586-pc-linux-gnu, compiled by gcc 2.7.2.3
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jose'

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jorge Herrera Piñero 1999-06-04 13:07:26 A little problem updating data with views
Previous Message Michael Klemme 1999-06-04 12:14:49 SQL Problem: ERROR: ExecEvalExpr: unknown expression type 108