Forum: Ruby on Rails PostgreSQL Array field type

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9b60116332d87125a96c464d729bbdca?d=identicon&s=25 Samer Abukhait (Guest)
on 2005-12-27 15:39
(Received via mailing list)
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?
821395fe70906c8290df7f18ac4ac6cf?d=identicon&s=25 Rick Olson (Guest)
on 2005-12-27 16:06
(Received via mailing list)
On 12/27/05, Samer Abukhait <abukhait@gmail.com> 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
5c19f2d52879a1e10670c7334ba4c7e3?d=identicon&s=25 Lugovoi Nikolai (Guest)
on 2005-12-27 16:18
(Received via mailing list)
D36eff3004b39abc4b93fe8a410d8bd3?d=identicon&s=25 Ron M (Guest)
on 2005-12-29 02:22
(Received via mailing list)
Rick Olson wrote:
> On 12/27/05, Samer Abukhait <abukhait@gmail.com> 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/...
http://www.locationintelligence.net/articles/657.html
http://postgis.refractions.net/
http://dev.mysql.com/doc/refman/5.0/en/spatial-ext...



   I'm just thinking out loud here, but I could see
821395fe70906c8290df7f18ac4ac6cf?d=identicon&s=25 Rick Olson (Guest)
on 2005-12-29 02:37
(Received via mailing list)
> 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-ext...

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
This topic is locked and can not be replied to.