Well I hacked around a solution for now...
stats.select(:stats__user_id, :alias, :year[1].AS(:value)).join(:profiles,
:user_id
=> :user_id).order(:year[1].DESC).limit(100).sql.gsub('(1)', '[1]')
But its ugly, if there was a way to get the [n] added to a column name
it would work.
On Dec 13, 5:07 pm, Jim Morris <[EMAIL PROTECTED]> wrote:
> Is there support for the postgresql data type array? (or SQL Array)?
>
> I have a query like like this...
>
> DB.execute('UPDATE tests SET year[1] = year[1] + month[1] WHERE
> month[1] > 0)
>
> also
>
> DB.fetch("SELECT user_id, year[1] AS value FROM stats WHERE year[1] >
> 0 ")
>
> Because I can't see how to specify an array element in the filter
> statement. obviously this doesn't work...
>
> stats.filter(:year[1] > 0)
>
> It would be nice to be able to use the filter or group or join stuff
> though with arrays.
>
> Also it would be nice to be able to do something like...
>
> stats= DB[:stats]
> stats << { :year => [1,2,3,4]}
>
> and have it generate the sql... INSERT INTO stats (year) VALUES
> ('{1,2,3,4}')
>
> for instance
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---