Re: Casting Varchar to Numeric
От | Tom Lane |
---|---|
Тема | Re: Casting Varchar to Numeric |
Дата | |
Msg-id | 20242.1009667277@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Casting Varchar to Numeric (Bruce Momjian <pgman@candle.pha.pa.us>) |
Ответы |
Re: Casting Varchar to Numeric
|
Список | pgsql-general |
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
В списке pgsql-general по дате отправления: