PostgreSQL Array field type

It seemed to me that rails extract the special database field type
(Array … In PostgreSQL) as a string… {‘One’,‘Two’}
wouldn’t it be great if it got converted to a Ruby array directly?

On 12/27/05, Samer A. [email protected] wrote:

It seemed to me that rails extract the special database field type
(Array … In PostgreSQL) as a string… {‘One’,‘Two’}
wouldn’t it be great if it got converted to a Ruby array directly?

I don’t see this making it into rails core because it is a database
specific feature. I’m just thinking out loud here, but I could see
there being database-specific plugins. Perhaps you could start a
postgresql plugin that integrates some of its cooler and unique
features into AR? It’d be a nice little project to use to learn the
internals of Active Record.


rick
http://techno-weenie.net

Take look at http://dev.rubyonrails.org/ticket/1480 and
http://dev.rubyonrails.org/ticket/3272

the SQL spec, they’re a reasonably widely recognized standard
http://www.locationintelligence.net/articles/657.html
http://postgis.refractions.net/
http://dev.mysql.com/doc/refman/5.0/en/spatial-extensions-in-mysql.html

I’d suggest submitting a patch, or you’ll have to wait until someone
else has the need for the feature and implements it. The plugin idea
is even better because you can get real-world usage out of it, making
it more likely to making it into rails core.


rick
http://techno-weenie.net

Rick O. wrote:

On 12/27/05, Samer A. [email protected] wrote:

It seemed to me that rails extract the special database field type
(Array … In PostgreSQL) as a string… {‘One’,‘Two’}
wouldn’t it be great if it got converted to a Ruby array directly?

I don’t see this making it into rails core because it is a database
specific feature.

Array datatypes are certainly part of the SQL Standard
http://farrago.sourceforge.net/design/CollectionTypes.html
and even if a database vendor handles them a bit poorly (in
nonstandard ways), it would be very nice if array functionality
were still available in ActiveRecord, which could mask the
nonstandard behavior.

I’d like to see OpenGIS standard spatial datatypes supported
in ActiveRecord as well – even though they’re not part of
the SQL spec, they’re a reasonably widely recognized standard
with support in Oracle, DB2, PostgreSQL and MySQL at least.
I think with third-party extensions (from ESRI) they can
work with SQL Server too.

Would that make it standard enough to get ActiveRecord Support.

(refs)

http://www.oracle.com/technology/products/spatial/htdocs/data_sheet_9i/9iR2_spatial_ds.html
http://www.locationintelligence.net/articles/657.html
http://postgis.refractions.net/
http://dev.mysql.com/doc/refman/5.0/en/spatial-extensions-in-mysql.html

I’m just thinking out loud here, but I could see