On Sep 22, 1:53 pm, Tamás Dénes <[email protected]> wrote: > Hi Jeremy, > > Unfortunately I was just able to upgrade my only serious app from Sequel 2.4 > to recent version. I've found a problem with select_more. If You call > select_more on a cloned dataset then the opts[:select] changes on both the > original and the cloned dataset. It caused me problem when I joined to the > cloned dataset and selected some fields from the joined dataset. In this > case the original dataset contains such fields in the select list which > belongs to tables not included in the from list. (And throws an > exception).This > bug was introduced in version 2.12.0. > > You can see the problem running the following code: > > DB = Sequel.sqlite > ds = DB[:table].select(:name) > p ds.opts > ds2 = ds.clone > puts ds.opts[:select].object_id > puts ds2.opts[:select].object_id > p ds2.select_more(:id).opts > p ds.opts > > The problem can be solved cloning the opts[:select] array before > concatenating to it as below: > > def select_more(*columns, &block) > select(*Array(@opts[:select]).clone.concat(columns), &block) > end > > or similarly to the pre 2.12 versions: > > def select_more(*columns, &block) > select(*(Array(@opts[:select]) + columns), &block) > end > > Anyway thanks for this great framework!
This is definitely a bug. I just pushed a fix to github for it (http://github.com/jeremyevans/sequel/commit/ aa9f92138c7759b640b25c6901347f2be3b409f9). Thanks for notifying me about this! 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 -~----------~----~----~----~------~----~------~--~---
