Tryton - Issues

 

Issue2405

Title NUMERIC type on sqlite does not work on in special cases
Priority bug Status resolved
Superseder Nosy List ced, reichlich
Type behavior Components trytond
Assigned To ced Keywords
Reviews

Created on 2012-01-16.14:50:15 by reichlich, last changed by ced.

Files
File name Uploaded Type Edit Remove
numeric.py reichlich, 2012-01-16.14:50:14 text/plain
Messages
msg14369 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2013-10-20.12:36:14
Fixed with rev 5a7f41b4200a
msg9923 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2012-01-30.10:51:47
On 30/01/12 09:51 +0100, Max Holtzberg wrote:
> Does python-sql address back end specific issues?

It is one of his goal.
msg9922 (view) Author: [hidden] (reichlich) Date: 2012-01-30.09:51:07
Does python-sql address back end specific issues?
msg9921 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2012-01-29.23:12:51
It will not work if there is a '?' in the query that is not a keyword.
For me, the best way will be implement such things in python-sql.
msg9919 (view) Author: [hidden] (reichlich) Date: 2012-01-29.22:59:53
Maybe it can be done like review234001
msg9883 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2012-01-27.01:23:28
I made some test and I think the issue is about the CAST affinity of SQLite.
http://www.sqlite.org/lang_expr.html
http://www.sqlite.org/datatype3.html
As we store NUMERIC as blob in SQLite to prevent precision lost, I think SQLite
make the comparison between NUMERIC and NONE.
So if we cast both side of the expression, it works:

    SELECT CAST('2.3' AS NUMERIC) > CAST(? AS NUMERIC)

A quick test show that it also work on PostgreSQL.
msg9810 (view) Author: [hidden] (reichlich) Date: 2012-01-16.14:50:14
The problem occurs on size comparison like < <= => > when a string is cast to
NUMERIC type.
This kind of cast is used for example for the property field, where
all data is stored as string and cast to the proper type for comparison.

See the enclosed numeric.py
History
Date User Action Args
2013-10-20 12:36:15cedsetstatus: deferred -> resolved
assignedto: ced
component: + trytond
messages: + msg14369
2012-12-13 23:11:19cedsetstatus: chatting -> deferred
2012-01-30 10:51:47cedsetmessages: + msg9923
2012-01-30 09:51:07reichlichsetmessages: + msg9922
2012-01-29 23:12:52cedsetmessages: + msg9921
2012-01-29 22:59:54reichlichsetmessages: + msg9919
2012-01-27 01:23:28cedsetstatus: unread -> chatting
messages: + msg9883
2012-01-16 14:50:15reichlichcreate

Showing 10 items. Show all history (warning: this could be VERY long)