Re: How to handle bogus nulls from ActiveRecord

From: "James B(dot) Byrne" <byrnejb(at)harte-lyne(dot)ca>
To: "Eric Hu" <eric(at)lemurheavy(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to handle bogus nulls from ActiveRecord
Date: 2011-05-13 13:12:15
Message-ID: 47557.216.185.71.25.1305292335.squirrel@webmail.harte-lyne.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Thu, May 12, 2011 20:30, Eric Hu wrote:
> David suggested using a guesstimate default date along with
> a boolean to indicate when you're using guesstimates.
> I think this is a solid approach, but if the default
> expected_by idea doesn't work for you, a boolean
> would still make this a lot easier on the Rails side.

Since this part of the project is still in development, albeit
partially in use for some purposes, all those approaches are under
cosnideration considered. In fact some things are implemented in
that fashion for other parts of the system, particularly with
respect to current status.

However, the main problem to be solved is this issue over the
default values for time stamp columns, all of which must have a NOT
NULL constraint since we simply cannot allow an errant application
overwrite valid data, as would have happened in the case under
consideration.

I am coming to the conclusion that an arbitrary value of 99991231 is
a better approach than using PGs built-in idea of 'infinity' since
I was told that concept is not supported in Ruby.

Actually, it turn out that 'infinity' is supported in Ruby.
Apparently infinity can be represented by assigning the value
obtained by dividing a float by zero.

$ irb
ruby-1.8.7-p334 :001 > infinity = 1.0/0
=> Infinity
ruby-1.8.7-p334 :002 > ninfinity = -1.0/0
=> -Infinity
ruby-1.8.7-p334 :003 >

So, I guess this now qualifies as a bug in the Ruby pg adapter gem.

--
*** E-Mail is NOT a SECURE channel ***
James B. Byrne mailto:ByrneJB(at)Harte-Lyne(dot)ca
Harte & Lyne Limited http://www.harte-lyne.ca
9 Brockley Drive vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada L8E 3C3

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2011-05-13 14:29:59 Re: pg_dumpall behavior in 9.1beta1
Previous Message Misa Simic 2011-05-13 09:40:01 Re: simple update query too long