On Thu, Aug 9, 2012 at 7:17 AM, Arthur Axel 'fREW' Schmidt <fri...@gmail.com
> wrote:

>  They are in a branch called topic/prefetch_tests.  We do have *one*test, but 
> it sounds like there may be other bugs, which is why I'd like to
> get tests from you and eric :)
>

Again, I don't know what triggers the bug.  It appears to be related to a
column named "source", because when I remove that one column the problem
goes away.   Seems unlikely to me, but that's all I have.

I was not able to duplicate in a DBIC unit test.





>
>
> On 08/07/2012 10:07 AM, Bill Moseley wrote:
>
>
>
> On Tue, Aug 7, 2012 at 6:24 AM, Arthur Axel 'fREW' Schmidt <
> fri...@gmail.com> wrote:
>
>>  Yeah, the fix is in the new devrel that castaway shipped.  If you could
>> join irc we could help you make the test more.
>>
>
>  test more... ?
>
>  I'd love help with that -- but I'm not sure when I'll have time to to
> catch you on irc.   I'll give the dev release a try -- but those fixes are
> not in git master yet?
>
>
>>
>> On 08/04/2012 06:46 PM, Bill Moseley wrote:
>>
>>
>> On Thu, Aug 2, 2012 at 6:25 AM, Arthur Axel 'fREW' Schmidt <
>> fri...@gmail.com> wrote:
>>
>>> Any chance we could get an ETA on this test?  the 0.08199 release is
>>> blocking on it.
>>>
>>
>>  Do you have a fix for this already?   That is, do you know what the
>> issue is?   Otherwise, I'm a bit stuck.
>>
>>  I wrote a new unit test (below) for DBIC, but the test passed.
>>
>>  So, I went back to my app and started cutting out code until I had just
>> three Result classes, and very simple DBIC setup.
>>
>>  What I finally found was when I removed a column named "source" the
>> problem went away.   Red herring, I'm not sure.
>>
>>  Wish I had something better to offer.   I made the following changes
>> and then I added the test below, but tests pass.  Any suggestion what else
>> to try?
>>
>>  I'm using PostgreSQL 9.0.4 on OS X and DBIx::Class from git.  On my
>> table "source" is "smallint" but there are many columns like that on that
>> table.
>>
>>
>>  moseley@bair ~/DBIx-Class $ git diff
>> diff --git a/t/lib/DBICTest/Schema/Artist.pm
>> b/t/lib/DBICTest/Schema/Artist.pm
>> index 2e9ff35..21179da 100644
>> --- a/t/lib/DBICTest/Schema/Artist.pm
>> +++ b/t/lib/DBICTest/Schema/Artist.pm
>> @@ -29,6 +29,7 @@ __PACKAGE__->add_columns(
>>      size => 10,
>>      is_nullable => 1,
>>    },
>> +  'source',
>>   );
>>  __PACKAGE__->set_primary_key('artistid');
>>  __PACKAGE__->add_unique_constraint(['name']);
>> diff --git a/t/lib/sqlite.sql b/t/lib/sqlite.sql
>> index 9d49210..2077463 100644
>> --- a/t/lib/sqlite.sql
>> +++ b/t/lib/sqlite.sql
>> @@ -10,7 +10,8 @@ CREATE TABLE artist (
>>    artistid INTEGER PRIMARY KEY NOT NULL,
>>    name varchar(100),
>>    rank integer NOT NULL DEFAULT 13,
>> -  charfield char(10)
>> +  charfield char(10),
>> +  source integer
>>  );
>>
>>  CREATE INDEX artist_name_hookidx ON artist (name);
>>
>>
>>
>>
>>  moseley@bair ~/DBIx-Class $ cat t/prefetch/undefined_inflaged_column.t
>> use warnings;
>> use strict;
>>
>>  use Test::More;
>> use lib qw(t/lib);
>> use DBICTest;
>>
>>  my $schema = DBICTest->init_schema();
>>
>>  plan tests => 7;
>>
>>  # Bug between .08196 and .08198 resulted in a prefetch setting
>> _inflated_column undefined.
>>
>>  # Grab any track.
>> my $search_track = $schema->resultset( 'Track' )->search( {}, { rows => 1
>> } )->first;
>>
>>  ok( $search_track, 'Fetched a track' );
>>
>>  my $track_id = $search_track->trackid;
>> ok( $track_id, "Feteched track id '$track_id'" );
>>
>>  my $track = $schema->resultset( 'Track' )->search(
>>     {
>>         'me.trackid' => $track_id,
>>     },
>>     {
>>         prefetch => [
>>             { cd => 'artist' },
>>         ],
>>     },
>> )->first;
>>
>>  my $cd = $track->cd;
>> ok( $cd, 'Found CD object' );
>> is( ref $cd->{_inflated_column}, 'HASH', 'Found _inflated_column hashref'
>> );
>>
>>  ok( exists $cd->{_inflated_column}{artist}, 'Found inflated "artist"
>> key' );
>>
>>  # This is where it fails
>> ok( defined $cd->{_inflated_column}{artist}, 'Inflated "artist" is
>> defined' );
>> ok( $cd->artist,  'The artist should be defined (or an artist)' );
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>>
>>> On 08/01/2012 09:36 AM, Arthur Axel 'fREW' Schmidt wrote:
>>> > Bill,
>>> >
>>> > Could you please write a test that fails on 0.08198 but passes on
>>> > 0.08198_01?  DBIC has a quite fully fleshed out test schema so I doubt
>>> > it should be difficult.  We *do* want to add the features in eventually
>>> > that were taken out in the dev rel so unless we get tests for these
>>> > regressions they will regress again :)
>>> >
>>> > (I know this is a near copy paste of a previous message, but the issues
>>> > may be subtly different)
>>> >
>>> > On 07/14/2012 05:53 PM, Bill Moseley wrote:
>>> >> On Tue, Jul 10, 2012 at 7:59 PM, fREW Schmidt <fri...@gmail.com>
>>> wrote:
>>> >>
>>> >>>     * Fixes
>>> >>>         - Fix complex has_many prefetch with resultsets not selecting
>>> >>> identity
>>> >>>           columns from the root result source
>>> >>>
>>> >> I'm wondering if this is related to a problem I'm seeing in this
>>> version
>>> >> where a column listed in _inflated_column is undefined.
>>> >>
>>> >>
>>> >> I've upgraded to SQL::Abstract 1.73 for both versions of DBIC below.
>>> >>
>>> >> In 0.08196 I don't see the problem (I can't upgraded to .08197).
>>> >>
>>> >> In 0.08198 what happens is I end up with a row with an
>>> _inflated_column
>>> >> with the column undef.
>>> >> In  0.08196 _inflated_column is a row object.
>>> >>
>>> >> For example, if I'm modeling school work -- if a class has many
>>> >> assignments, and an assignment has many papers, then:
>>> >>
>>> >>
>>> >> my $paper = $schema->resultset( 'Paper' )->search(
>>> >>     { 'me.id' => $id },
>>> >>     {
>>> >>         prefetch => [
>>> >>             { assignment => 'class' },
>>> >>         ],
>>> >>     }
>>> >> )->first;
>>> >>
>>> >> my $assignment = $paper->assignment;
>>> >> warn Dumper $assignment->{_inflated_column};
>>> >>
>>> >> print $assignment->class->id;
>>> >>
>>> >>
>>> >> # in .08198 $assignment->{_inflated_column}{class} is undefined
>>> >> # in .08196 $assignment->{_inflated_column}{class} is a class row
>>> object.
>>> >>
>>> >>
>>> >> Which results in:
>>> >>
>>> >> $VAR1 = {
>>> >>           'class' => undef
>>> >>         };
>>> >> Can't call method "id" on an undefined value ....
>>> >>
>>> >>
>>> >> If I revert to 96 then "class" references a ::Result::Class object.
>>> >>
>>> >>
>>> >> Is this a know issue?
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> _______________________________________________
>>> >> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
>>> >> IRC: irc.perl.org#dbix-class
>>> >> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
>>> >> Searchable Archive:
>>> http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>>> >>
>>>
>>>
>>>
>>> _______________________________________________
>>> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
>>> IRC: irc.perl.org#dbix-class
>>> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
>>> Searchable Archive:
>>> http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>>>
>>
>>
>>
>>  --
>> Bill Moseley
>> mose...@hank.org
>>
>>
>> _______________________________________________
>> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
>> IRC: irc.perl.org#dbix-class
>> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
>> Searchable Archive: 
>> http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>>
>>
>>
>> _______________________________________________
>> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
>> IRC: irc.perl.org#dbix-class
>> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
>> Searchable Archive:
>> http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>>
>
>
>
>  --
> Bill Moseley
> mose...@hank.org
>
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>
>
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>



-- 
Bill Moseley
mose...@hank.org
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk

Reply via email to