I would like to use the postgres array type from rails. I want be sure that I understand the current state of rails/postgres array compatibility. While googling, I found Ticket #4664, "PostgreSQL array data types being returned as Fixnum". If I understand the ticket correctly, if I have a pre-existing database that uses, say, the postgres int[], it will become a string in rails. But it is not clear whether I could update the record, or create a new record. I''m also not sure whether the patch works for floats and doubles as well. I''m not familiar (yet?) with the rails code or the C postgres/rails adaptor. Hypothetically speaking, if someone wanted to "fix" this, would they need to look at rails code, the postgres adaptor, or both? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On 4/13/07, Rick Schumeyer <rschumeyer@ieee.org> wrote:> > I would like to use the postgres array type from rails. I want be > sure that I understand the current state of rails/postgres array > compatibility. > > While googling, I found Ticket #4664, "PostgreSQL array data types > being returned as Fixnum". If I understand the ticket correctly, if I > have a pre-existing database that uses, say, the postgres int[], it > will become a string in rails. But it is not clear whether I could > update the record, or create a new record. I''m also not sure whether > the patch works for floats and doubles as well. > > I''m not familiar (yet?) with the rails code or the C postgres/rails > adaptor. Hypothetically speaking, if someone wanted to "fix" this, > would they need to look at rails code, the postgres adaptor, or both?The rails postgres adapter probably. -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
FYI, I saw a very interesting Postgres patch hit Trac the other day. Really beeds up support. http://dev.rubyonrails.org/ticket/8049 On Apr 13, 2007, at 9:55 AM, Rick Olson wrote:>> I''m not familiar (yet?) with the rails code or the C postgres/rails >> adaptor. Hypothetically speaking, if someone wanted to "fix" this, >> would they need to look at rails code, the postgres adaptor, or both? > > The rails postgres adapter probably.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Hey Rick,> While googling, I found Ticket #4664, "PostgreSQL array data types > being returned as Fixnum". If I understand the ticket correctly, if I > have a pre-existing database that uses, say, the postgres int[], it > will become a string in rails. But it is not clear whether I could > update the record, or create a new record. I''m also not sure whether > the patch works for floats and doubles as well.Currently the PostgreSQL adapter converts any array of any type to string format. You can read and write arrays as per the PostgreSQL documentation at http://www.postgresql.org/docs/current/static/arrays.html.> I''m not familiar (yet?) with the rails code or the C postgres/rails > adaptor. Hypothetically speaking, if someone wanted to "fix" this, > would they need to look at rails code, the postgres adaptor, or both?Exactly what would you like to "fix"? When I was busy with the patch that Hunter kindly referenced I was thinking to maybe convert PostgreSQL arrays to true Ruby arrays, and vice versa. I decided not to because: - it would add quite a lot of code complexity; - it would potentially break a lot of PostgreSQL-dependent applications out there that expect the string behavior; - it wouldn''t make sense to have PostgreSQL work with Ruby arrays throughout Rails when the other database adapters don''t. Interested to hear your thoughts about improved handling of arrays. - Roderick --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Roderick, Thanks for the info. You are right, if I can read/write postgres arrays and have them be strings in ruby, that is probably good enough. I guess that I would need to create the table with an array outside of ruby?>- it wouldn''t make sense to have PostgreSQL work with Ruby arrays >throughout Rails when the other database adapters don''t.Well, this isn''t the right place for a database independent/database specific debate. As a new rails user, I get the impression that database independence is highly valued in the rails community. Personally, I could live with some database dependence, but I''m hardly in a position to suggest any changes. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---