On Sep 21, 1:57 pm, Joe Van Dyk <[email protected]> wrote:
> Does sequel support postgresql arrays?  What about arrays of custom
> types?

Sequel's built-in support for arrays is currently limited to the
sql_subscript method/Sequel::SQL::Subscript class.  There's no support
for handling arrays when retrieved from the database (they are
returned as strings in the "{...}" format).

> If not, what would it take to get that?
>
> I foundhttps://github.com/gucki/sequel_column_type_array, but it's
> pretty incomplete.

This has the basic idea, using separate classes per array type.  I
wouldn't subclass from Array though.  The model he uses shouldn't be
that hard to work with custom types, but the parser he is using works
only in trivial cases.  He's using the String#parse_csv method from
FasterCSV (which is ruby 1.9's default CSV class).

True parsing of multiple dimensional PostgreSQL arrays probably
requires a real parser, and that parser may change depending on the
the type of the array.  It's possible, but it's probably a lot of
work.

I'm happy to provide advice and/or code review for anyone planning to
implement PostgreSQL array support, but it's not something I plan to
implement myself.

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to