From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>, Andy Marden <amarden(at)usa(dot)net>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Casting Varchar to Numeric |
Date: | 2002-02-23 01:58:13 |
Message-ID: | 200202230158.g1N1wDd28966@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Added to TODO.detail/typeconv.
---------------------------------------------------------------------------
Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > I can see problems with automatically casting numeric to text because
> > you have to guess the desired format, but going from text to numeric
> > seems quite easy to do. Is there a reason we don't do it?
>
> I do not think it's a good idea to have implicit casts between text and
> everything under the sun, because that essentially destroys the type
> checking system. What we need (see previous discussion) is a flag in
> pg_proc that says whether a type conversion function may be invoked
> implicitly or not. I've got no problem with offering text(numeric) and
> numeric(text) functions that are invoked by explicit function calls or
> casts --- I just don't want the system trying to use them to make
> sense of a bogus query.
>
> > I can cast to integer and float8 fine:
>
> I don't believe that those should be available as implicit casts either.
> They are, at the moment:
>
> regression=# select 33 || 44.0;
> ?column?
> ----------
> 3344
> (1 row)
>
> Ugh.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Konrad Scherer | 2002-02-23 02:07:53 | Wierdness using SUM to add results of custom C function. |
Previous Message | Bruce Momjian | 2002-02-23 00:20:56 | Re: Speed comparison to Oracle. Why was this query slower |