Skip Menu |

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 86685
Status: resolved
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: jwcarlson [...] lbl.gov
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.082801



CC: Joel Martin <j_martin [...] lbl.gov>
Subject: strange behavior with set_column
Date: Wed, 3 Jul 2013 13:32:17 -0700
To: dbix-class [...] lists.scsys.co.uk, bug-DBIx-Class [...] rt.cpan.org
From: Joe Carlson <jwcarlson [...] lbl.gov>
Hello, I've noticed strange behavior with perl 5.16/ DBIx::Class 0.08204 that I did not see with perl 5.10/DBIx::Class 0.08120 I'm looking at a resultset record which involves a joined table. I'm working with a local copy and setting in_storage(0). If I attempt to set a value for a column in one of the joined column names, I get a 'No such column', but only the second time I attempt to set it. A snippet of code is something that joins a table 'feature' with 'featureloc'. 'fmin' is a column in Featureloc my $featureRS = $session->db->dbh->resultset('Feature')->search( { 'me.feature_id' => 13039071 }, { join => 'featureloc_feature_ids', '+select' => ['featureloc_feature_ids.fmin'], '+as' => ['fmin']}); my $feature = $featureRS->first; my $fmin = $feature->get_column('fmin'); # no problem $feature->in_storage(0); $feature->set_column('fmin'=>12); # so far, so good $feature->set_column('fmin'=>102); # error here. The error occurs only if I have the second call to set_column with fmin. And in 0.082404 but not 0.08120. I believe the problem arises when the second call is attempting to see if the new value in set_column differs from the previous. I'm suspicious of the call to _is_column_numeric in _eq_column_values in DBIx::Class::Row. The code in 0.08250 looks similar to my version in this call. Joe Carlson
Subject: Re: Bug #86685
Date: Tue, 1 Apr 2014 14:48:20 -0700
To: bug-DBIx-Class [...] rt.cpan.org
From: Joe Carlson <jwcarlson [...] lbl.gov>
Hello, 9 months ago I reported some strange behavior with set_column. Essentially, trying to call set_column on a row in which the column to be set is a from a join and is_storage was false resulted in an error the second time set_column was called. (The first call was successful.) I've been stumbling this some more and now I think I see what the issue is. There is a bad assumption of operator precedence in Row.pm The code (beginning at line 840 in my version) my $dirty = $self->{_dirty_columns}{$column} || $in_storage # no point tracking dirtyness on uninserted data ? ! $self->_eq_column_values ($column, $old_value, $new_value) : 1 ; should be my $dirty = $self->{_dirty_columns}{$column} || ($in_storage # no point tracking dirtyness on uninserted data ? ! $self->_eq_column_values ($column, $old_value, $new_value) : 1 ) ; If the column has already been marked dirty, there is no need to ask whether the new value differs from the old value. But that was not short stopping the evaluation of _eq_column_values. Inside _eq_column_values, there is a call to _is_column_numeric that was generating the error when calling column_info on the joined column name.
On Tue Apr 01 23:48:38 2014, jwcarlson@lbl.gov wrote: Show quoted text
> > Hello, > > 9 months ago I reported some strange behavior with set_column. > Essentially, trying to call set_column on a row in which the column to > be set is a from a join and is_storage was false resulted in an error > the second time set_column was called. (The first call was > successful.) > > I've been stumbling this some more and now I think I see what the > issue is. There is a bad assumption of operator precedence in Row.pm > > The code (beginning at line 840 in my version) > > my $dirty = > $self->{_dirty_columns}{$column} > || > $in_storage # no point tracking dirtyness on uninserted data > ? ! $self->_eq_column_values ($column, $old_value, $new_value) > : 1 > ; > > should be > > > my $dirty = > $self->{_dirty_columns}{$column} > || > ($in_storage # no point tracking dirtyness on uninserted data > ? ! $self->_eq_column_values ($column, $old_value, $new_value) > : 1 ) > ; > > If the column has already been marked dirty, there is no need to ask > whether the new value differs from the old value. But that was not > short stopping the evaluation of _eq_column_values. Inside > _eq_column_values, there is a call to _is_column_numeric that was > generating the error when calling column_info on the joined column > name.
Thanks for the diagnosis and sorry for the delay. There is a very high chance this will finally be addressed during the hackathon this weekend. Cheers!
On Tue Apr 01 23:48:38 2014, jwcarlson@lbl.gov wrote: Show quoted text
> I've been stumbling this some more and now I think I see what the > issue is. There is a bad assumption of operator precedence in Row.pm >
While your diagnosis is correct - this is only half of the issue. The full fix has finally been landed in https://github.com/dbsrgits/dbix-class/commit/57e9c142d. Thank you for the report!