Re: FloatField will not handle infinity values (Ticket #4287)
I sent in another patch that acts as proposed by Gabriel. With this patch one can enable to store infinity and it is checked against a DataBaseFeature if it is possible. Storing infinity without having it enabled on that particular field will lead to an exception. It is also a backwards compatible solution. Would that solution be appropriate? Conrad On Apr 28, 10:45 pm, Gabriel Hurley wrote: > This seems to me like a problem best-solved by adding another attribute to > BaseDatabaseFeatures so that DBs which don't support infinity can fail > loudly, obviously, and preemptively. That make sense? > > - Gabriel -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: FloatField will not handle infinity values (Ticket #4287)
This seems to me like a problem best-solved by adding another attribute to BaseDatabaseFeatures so that DBs which don't support infinity can fail loudly, obviously, and preemptively. That make sense? - Gabriel -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: FloatField will not handle infinity values (Ticket #4287)
On Wed, Apr 27, 2011 at 2:30 PM, Tobias McNulty wrote: > On Wed, Apr 27, 2011 at 9:31 AM, Luke Plant wrote: > >> ... If you need to store >> infinity in a database column, it's better to know sooner that your >> database doesn't support it so you can find one that does. >> > > +1 > -- > Tobias McNulty, Managing Partner > Caktus Consulting Group, LLC > http://www.caktusgroup.com > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To post to this group, send email to django-developers@googlegroups.com. > To unsubscribe from this group, send email to > django-developers+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-developers?hl=en. > Storing sys.maxint in place of float('inf') in a database column is so wildly inappropriate that it actually takes someone more articulate than me to describe, and as such any emulation will fail on similar grounds (notably that it dupes a valid value), however I don't think that should prevent us from supporting it on DBs that do support it (PostgreSQL doing the right thing... again!) Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: FloatField will not handle infinity values (Ticket #4287)
On Wed, Apr 27, 2011 at 9:31 AM, Luke Plant wrote: > ... If you need to store > infinity in a database column, it's better to know sooner that your > database doesn't support it so you can find one that does. > +1 -- Tobias McNulty, Managing Partner Caktus Consulting Group, LLC http://www.caktusgroup.com -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: FloatField will not handle infinity values (Ticket #4287)
On Wednesday 27 April 2011, Jacob Kaplan-Moss wrote: > On Wed, Apr 27, 2011 at 2:44 AM, Conrad Calmez wrote: > > My Fix uses the minimal and maximal float values > > (-2147483648 / 2147483647) as -inf/inf. [...] > > I really don't think that's a good idea. "Magic" numbers are rather > gross, and 2147483647 is a long way from +inf. > In fact, it's also a long way from the maximal float -- it's the maximal int. The maximal float is on the order of 10^38. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: FloatField will not handle infinity values (Ticket #4287)
On 27/04/11 08:44, Conrad Calmez wrote: > Dear Community, > > two weeks ago I started fixing the ticket #4287. It appears that > infinity values can not be stored to FloatFields using MySQL (that is > what I reproduced). I found out that MySQL can not handle infinity > values. My Fix uses the minimal and maximal float values > (-2147483648 / 2147483647) as -inf/inf. > My questions is if that way of fixing this bug is acceptable. If so I > will also try to reproduce/fix this bug for other db backends. The problem I anticipate is what happens when you try to do any maths or logic with this value. For example, with Postgres, Infinity does work, and obeys the IEEE 754 spec. So, at the point where a developer runs some non trivial queries against the table containing these pseudo-infinity values, the illusion of portability we have created will break down. So, I for one would not be in favour of this fix. It's not helpful for Django to attempt to hide lack of support for something in the underlying database unless we can do so perfectly. If you need to store infinity in a database column, it's better to know sooner that your database doesn't support it so you can find one that does. Regards, Luke -- "I was sad because I had no shoes, until I met a man who had no feet. So I said, "Got any shoes you're not using?" (Steven Wright) Luke Plant || http://lukeplant.me.uk/ -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: FloatField will not handle infinity values (Ticket #4287)
On Wed, Apr 27, 2011 at 2:44 AM, Conrad Calmez wrote: > two weeks ago I started fixing the ticket #4287. It appears that > infinity values can not be stored to FloatFields using MySQL (that is > what I reproduced). I found out that MySQL can not handle infinity > values. My Fix uses the minimal and maximal float values > (-2147483648 / 2147483647) as -inf/inf. > My questions is if that way of fixing this bug is acceptable. If so I > will also try to reproduce/fix this bug for other db backends. I really don't think that's a good idea. "Magic" numbers are rather gross, and 2147483647 is a long way from +inf. If MySQL can't support inf/-inf, then Django can't, either. About the only thing we should do in that case is throw a better exception. Jacob -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
FloatField will not handle infinity values (Ticket #4287)
Dear Community, two weeks ago I started fixing the ticket #4287. It appears that infinity values can not be stored to FloatFields using MySQL (that is what I reproduced). I found out that MySQL can not handle infinity values. My Fix uses the minimal and maximal float values (-2147483648 / 2147483647) as -inf/inf. My questions is if that way of fixing this bug is acceptable. If so I will also try to reproduce/fix this bug for other db backends. Truly Yours, Conrad -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.