RE: [HACKERS] Numeric with '-'

Поиск
Список
Период
Сортировка
От Hiroshi Inoue
Тема RE: [HACKERS] Numeric with '-'
Дата
Msg-id NDBBIJLOILGIKBGDINDFAEADCDAA.Inoue@tpf.co.jp
обсуждение исходный текст
Ответ на Re: [HACKERS] Numeric with '-'  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [HACKERS] Numeric with '-'  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
> -----Original Message-----
> From: owner-pgsql-hackers@postgreSQL.org
> [mailto:owner-pgsql-hackers@postgreSQL.org]On Behalf Of Tom Lane
> 
> "Hiroshi Inoue" <Inoue@tpf.co.jp> writes:
> >> They didn't give any such warning before, either.  I doubt I've
> >> made anything worse.
> 
> > Before your change
> > INSERT into t (numdata) values (-1234567890.1234567);
> > caused an error
> > ERROR:  Unable to convert left operator '-' from type 'unknown'.
> > but currently inserts a constant -1234567890.12346.
> 
> Yipes, you are right.  I think that that sort of construct should
> result in the value not getting converted at all until the parser
> knows that it must be converted to the destination column's type.
> Let me see if I can find out what's going wrong.  If this doesn't
> seem to be fixable, I may have to back off the patch...
>

This seems to be fixed.
Thanks a lot.

However there still remains the following case.
select * from num_data where val = 1.1;
ERROR:  Unable to identify an operator '=' for types 'numeric' and 'float8'       You will have to retype this query
usingan explicit cast
 

SQL standard seems to say 1.1 is a numeric constant and
it's not good to treat a numeric value as an aproximate value.
For example,what do you think about the following.

select 11111111111111 * 1.1;    ?column?     
------------------12222222222222.1
(1 row)

select 111111111111111 * 1.1;   ?column?     
-----------------122222222222222
(1 row)

select 100000000 + .000001;    ?column?     
------------------100000000.000001
(1 row)

select 100000000 + .0000001;?column?  
-----------100000000
(1 row)

select 100000000.0000001;    ?column?      
-------------------100000000.0000001
(1 row)

Regards.

Hiroshi Inoue
Inoue@tpf.co.jp


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Web page on bug reports
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Numeric with '-'