Re: Casting Varchar to Numeric
От | Bruce Momjian |
---|---|
Тема | Re: Casting Varchar to Numeric |
Дата | |
Msg-id | 200202230158.g1N1wDd28966@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: Casting Varchar to Numeric (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-general |
Added to TODO.detail/typeconv. --------------------------------------------------------------------------- Tom Lane wrote: > Bruce Momjian <pgman@candle.pha.pa.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@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
В списке pgsql-general по дате отправления: