Small bug with numeric in 7.0 (also in 6.5.3)
От | Denis Sbragion |
---|---|
Тема | Small bug with numeric in 7.0 (also in 6.5.3) |
Дата | |
Msg-id | 4.3.1.20000511120146.00dc8aa0@pop3.InfoTecna.com обсуждение исходный текст |
Список | pgsql-bugs |
Hello, look at this: pgsql=# \d aocc Table "aocc" Attribute | Type | Modifier ------------------+---------------+---------- nordine | integer | not null anno | integer | not null cliente | varchar(50) | not null data_ordine | date | not null rif_cliente | varchar(50) | controvalore_ord | numeric(18,4) | note | varchar(150) | Indices: aocc_anno_idx, aocc_pkey Constraints: (anno > 1900) (length(cliente) > 0) pgsql=# UPDATE aocc SET controvalore_ord = 320.5 WHERE controvalore_ord = 320.5 00 AND oid = 21624; ERROR: Unable to identify an operator '=' for types 'numeric' and 'float8' You will have to retype this query using an explicit cast This kind of weird query are generated by MS Query through the ODBC driver. Furthermore I tried: pgsql=# UPDATE aocc SET controvalore_ord = 320.5 WHERE controvalore_ord = 320.5::numeric(18,4) AND oid = 21624; UPDATE 1 pgsql=# UPDATE aocc SET controvalore_ord = 320.5 WHERE controvalore_ord = 320.5::numeric(17,3) AND oid = 21624; UPDATE 1 pgsql=# UPDATE aocc SET controvalore_ord = 320.5 WHERE float8(controvalore_ord)= 320.5 AND oid = 21624; UPDATE 1 pgsql=# UPDATE aocc SET controvalore_ord = 320.5 WHERE controvalore_ord = '320.5' AND oid = 21624; UPDATE 1 pgsql=# UPDATE aocc SET controvalore_ord = 320.5 WHERE controvalore_ord = numeric(320.5) AND oid = 21624; ERROR: parser: parse error at or near "320.5" pgsql=# UPDATE aocc SET controvalore_ord = 320.5 WHERE controvalore_ord = numeric(320.5,4) AND oid = 21624; ERROR: parser: parse error at or near "320.5" I don't know which of these queries is correct and which is wrong, anyway I hope this could help you track the problem. It looks like there's an automatic conversion from char to numeric, from numeric to numeric with different precision, but not from floatX to numeric. Also the 'numeric' function with float arguments is in the list reported by '\df numeric', but looks like it isn't used. May be it simply shouldn't be used like i did in the previous queries. Bye! P.S. My compliments for your all *great* work. -- Denis Sbragion InfoTecna Tel, Fax: +39 039 2324054 URL: http://infotecna.home.dhs.org
В списке pgsql-bugs по дате отправления: