On Sep 17, 2013, at 6:57 PM, Robb Shecter wrote:

> Matt jones wrote:
> 
> The best type to use to store DateTime objects is database-dependent: 
> 
> 
> So Ketan's finding seems to be correct, and this is something we should fix. 
> I.e., Rails' concept of timestamps should be database independent, just as 
> its concept of the primary key type is. (?) 
> 

I think you missed the point of my post: the choice of column MUST be 
database-dependent, since there's no type that's consistently available across 
all DB engines. 

Handling these differences in a way that's transparent to higher levels is one 
of ActiveRecord's responsibilities - for another example, note that boolean 
columns are stored in database-dependent ways: Mysql uses tinyint, SQLite uses 
a string with 't' or 'f', Postgres uses a native boolean type, etc.

For what it's worth, not even the primary key type is consistent if you go a 
little farther afield. For instance, the built-in Mysql adapter uses an 
INTEGER(11) field for primary keys, but the oracle-enhanced adapter uses 
NUMBER(38) which doesn't even have the same available range.

--Matt Jones

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to