Re: [GENERAL] A mistake generates strange result

From: "jose' soares" <sferac(at)bo(dot)nettuno(dot)it>
To: Stéphane Dupille <sdupille(at)i-france(dot)com>
Cc: "pgsql-general(at)postgreSQL(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: [GENERAL] A mistake generates strange result
Date: 1999-02-12 14:06:50
Message-ID: 36C4357A.18AC0861@bo.nettuno.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Stéphane Dupille ha scritto:

> Hi !
>
> "Ricardo J.C.Coelho" <pulsar(at)truenet-ce(dot)com(dot)br> writes:
> > Just for PgSQL's development group think about....
> > I made a mistake typing a query that generates a strange result
> > (Very strange).
>
> > The query: select text('12345678'::float8);
> > It returns a date in datetime format !!!!!!
>
> I didn't found any function of name "text" that converts
> float8 to text. So I think Postgres made an implicit cast of the data
> to datatime. So: String->Float8->DateTime->Text. Stranger : I didn't
> found any function to cinvert float to text !
>
> > If you use: select ('12345678'::float8)::text; everything runs well.
>
> Here, you made an explicit cast, without the use of any
> function. So your data is casted well.
>
> Hope this helps !

This seems like a bug, because there's no a text(float8) built-in function.

hygea=> select text('12345678'::float8);
text
----------------------
2000-05-22 23:21:18+02

but if you create the function like:

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

select text('12345678.2'::float8);
text
----------
12345678.2
(1 row)

- Jose' -

And behold, I tell you these things that ye may learn wisdom; that ye may
learn that when ye are in the service of your fellow beings ye are only
in the service of your God. - Mosiah 2:17 -

In response to

Browse pgsql-general by date

  From Date Subject
Next Message The Hermit Hacker 1999-02-12 14:21:27 Re: Subject: Re: [GENERAL] A book for PgSQL? A need? yes? no?
Previous Message Gilles Darold 1999-02-12 13:15:37 Re: [GENERAL] Problems compiling

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 1999-02-12 14:12:07 Re: [HACKERS] Backend problem with large objects
Previous Message Jose' Soares 1999-02-12 13:53:21 Re: [HACKERS] view?