ResultSet columns attribute broken?

17 messages Options
Embed this post
Permalink
Bernhard Graf

ResultSet columns attribute broken?

Reply Threaded More More options
Print post
Permalink
After upgrading to 0.08100 some of my DBIC code showed error messages
similar to what was discussed in
http://n2.nabble.com/DBIx::Class-0.08100-released-to-CPAN-td2659408.html

The only difference: It happened with search().

It turned out, that the following doesn't work anymore:

(modified from t/76select.t)

my @cds = $schema->resultset('CD')->search({},
    {
        'join' => 'artist',
        'columns' => ['me.cdid','me.title','artist.name'],
    }
);

DBIx::Class::ResultSet::search(): Column artist not loaded or not passed
to new() prior to insert() on DBICTest::CD=HASH(0x199d820) trying to
resolve relationship (maybe you forgot to call ->reload_from_storage to
get defaults from the db) at t/76select.t line 13

whereas this works:

my @cds = $schema->resultset('CD')->search({},
    {
        'join' => 'artist',
        '+columns' => ['artist.name'],
    }
);




Bernhard Graf

_______________________________________________
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@...
Justin Hunter

Re: ResultSet columns attribute broken?

Reply Threaded More More options
Print post
Permalink
can you try svn trunk?
(http://dev.catalyst.perl.org/repos/bast/DBIx-Class/0.08/trunk/)

Justin

Bernhard Graf wrote:

> After upgrading to 0.08100 some of my DBIC code showed error messages
> similar to what was discussed in
> http://n2.nabble.com/DBIx::Class-0.08100-released-to-CPAN-td2659408.html
>
> The only difference: It happened with search().
>
> It turned out, that the following doesn't work anymore:
>
> (modified from t/76select.t)
>
> my @cds = $schema->resultset('CD')->search({},
>     {
>         'join' => 'artist',
>         'columns' => ['me.cdid','me.title','artist.name'],
>     }
> );
>
> DBIx::Class::ResultSet::search(): Column artist not loaded or not passed
> to new() prior to insert() on DBICTest::CD=HASH(0x199d820) trying to
> resolve relationship (maybe you forgot to call ->reload_from_storage to
> get defaults from the db) at t/76select.t line 13
>
> whereas this works:
>
> my @cds = $schema->resultset('CD')->search({},
>     {
>         'join' => 'artist',
>         '+columns' => ['artist.name'],
>     }
> );
>
>
>
>
> Bernhard Graf
>
> _______________________________________________
> 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@...
>  


_______________________________________________
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@...
Bernhard Graf

Re: ResultSet columns attribute broken?

Reply Threaded More More options
Print post
Permalink
> can you try svn trunk?
> (http://dev.catalyst.perl.org/repos/bast/DBIx-Class/0.08/trunk/)

same thing.
--
Bernhard Graf

_______________________________________________
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@...
Peter Rabbitson-2

Re: ResultSet columns attribute broken?

Reply Threaded More More options
Print post
Permalink
Bernhard Graf wrote:
>> can you try svn trunk?
>> (http://dev.catalyst.perl.org/repos/bast/DBIx-Class/0.08/trunk/)
>
> same thing.

I think Justin nailed it last night. Please try current trunk.

Thanks

_______________________________________________
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@...
Bernhard Graf

Re: ResultSet columns attribute broken?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Bernhard Graf
Note: This Email was send by Peter as PM, but I suppose this happend by
accident, therefore I post my answer to the list.

> > No, my testing yesterday was already with the "nailed" revision
> > (6002).
>
> "last night" is a variable notion :) Please test r6015 or later.

6017: Well, err, I'm confused. t/76select.t seems to test the columns
attribute problem, although I don't understand everything there.
make test runs ok.
When I run the test with verbose output, it shows errors - but at the
end claims "All tests successful":

perl -MExtUtils::Command::MM -e "test_harness(1, 'inc', 'blib/lib', 'blib/arch')" t/76select.t
t/76select....1..23
ok 1 - additional count rscolumn present
ok 2 - nonexistant column requests still throw exceptions
ok 3 - multiple +select/+as columns, 1st rscolumn present
ok 4 - multiple +select/+as columns, 2nd rscolumn present
ok 5 - got rows from ->all using +select
ok 6 - +select/+as chained search 1st rscolumn present
ok 7 - +select/+as chained search 1st rscolumn present
ok 8 - +select/+as chained search 3rd rscolumn present
ok 9 - Initially populated with more than 2 CDs
ok 10 - Subselect correctly limited the rs to 2 cds
ok 11 - First CD title match
ok 12 - Second CD title match
ok 13 - $rs->current_source_alias returns "me"
not ok 14 - as_query() returned empty bindval arrayref # TODO as_query() inconsistent

#   Failed (TODO) test 'as_query() returned empty bindval arrayref'
#   at t/76select.t line 88.
#          got: '1'
#     expected: '2'
ok 15 - Use of columns attribute results in proper sql
ok 16 - columns 1st rscolumn present
ok 17 - columns 2nd rscolumn present
not ok 18 - columns 3rd rscolumn present # TODO Need to remove '.' from accessors

#   Failed (TODO) test 'columns 3rd rscolumn present'
#   at t/76select.t line 110.
# died: DBIx::Class::Exception (DBIx::Class::Row::get_column(): No such column 'artist.name' at t/76select.t line 109
# )
not ok 19 - as_query() returned empty bindval arrayref # TODO as_query() inconsistent

#   Failed (TODO) test 'as_query() returned empty bindval arrayref'
#   at t/76select.t line 123.
#          got: '1'
#     expected: '2'
ok 20 - Use of columns attribute results in proper sql
ok 21 - columns 1st rscolumn present
ok 22 - columns 2nd rscolumn present
not ok 23 - columns 3rd rscolumn present # TODO Need to remove '.' from accessors

#   Failed (TODO) test 'columns 3rd rscolumn present'
#   at t/76select.t line 145.
# died: DBIx::Class::Exception (DBIx::Class::Row::get_column(): No such column 'artist.name' at t/76select.t line 144
# )
ok
All tests successful.
Files=1, Tests=23,  1 wallclock secs ( 0.76 cusr +  0.11 csys =  0.87 CPU)

--
Bernhard Graf

_______________________________________________
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@...
Peter Rabbitson-2

Re: ResultSet columns attribute broken?

Reply Threaded More More options
Print post
Permalink
Bernhard Graf wrote:

> Note: This Email was send by Peter as PM, but I suppose this happend by
> accident, therefore I post my answer to the list.
>
>>> No, my testing yesterday was already with the "nailed" revision
>>> (6002).
>> "last night" is a variable notion :) Please test r6015 or later.
>
> 6017: Well, err, I'm confused. t/76select.t seems to test the columns
> attribute problem, although I don't understand everything there.
> make test runs ok.
> When I run the test with verbose output, it shows errors - but at the
> end claims "All tests successful":
>

Yes because you are looking at TODO tests, don't worry about those.
I was actually asking if your live development code works, not the
test suite. Once we confirm that we have fixed your problem we will
release another DBIC version.

Cheers

_______________________________________________
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@...
Bernhard Graf

Re: ResultSet columns attribute broken?

Reply Threaded More More options
Print post
Permalink
Peter Rabbitson wrote:

> Yes because you are looking at TODO tests, don't worry about those.
> I was actually asking if your live development code works, not the
> test suite. Once we confirm that we have fixed your problem we will
> release another DBIC version.

Ah, ok.

So I did install and - YES - it works fine!

Thanks for your patience. ;-)
--
Bernhard Graf

_______________________________________________
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@...
Peter Rabbitson-2

Re: ResultSet columns attribute broken?

Reply Threaded More More options
Print post
Permalink
Bernhard Graf wrote:

> Peter Rabbitson wrote:
>
>> Yes because you are looking at TODO tests, don't worry about those.
>> I was actually asking if your live development code works, not the
>> test suite. Once we confirm that we have fixed your problem we will
>> release another DBIC version.
>
> Ah, ok.
>
> So I did install and - YES - it works fine!
>
> Thanks for your patience. ;-)

0.08102 now on CPAN, includes the above fix.

Cheers

_______________________________________________
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@...
Benjamin Schuster-Boeckler

Re: ResultSet columns attribute broken?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Bernhard Graf
> Bernhard Graf wrote:
>> Peter Rabbitson wrote:
>>
>>> Yes because you are looking at TODO tests, don't worry about those.
>>> I was actually asking if your live development code works, not the
>>> test suite. Once we confirm that we have fixed your problem we will
>>> release another DBIC version.
>>
>> Ah, ok.
>>
>> So I did install and - YES - it works fine!
>>
>> Thanks for your patience. ;-)
>
> 0.08102 now on CPAN, includes the above fix.
>
> Cheers
>

I'm sorry to say, but I still get this error. I have the following  
query (from within Catalyst):

$c->model('DB::Line')->search({ 'types.name' => {'!=', 'Connection'} },
                                                         { join     =>  
[qw/ types /],
                                                           prefetch =>  
[qw/ types /],
                                                           select   =>  
[qw/me.name types.name/],
                                                           distinct =>  
1,
                                                           order_by =>  
[qw/types.name me.name/]
                                                         }

This used to work just fine, until 0.0810x. Now I get

DBIx::Class::ResultSet::search(): Column type not loaded or not passed  
to new() prior to insert() on  
TMEditor::Model::DB::Line=HASH(0x2662620) trying to resolve  
relationship (maybe you forgot to call ->reload_from_storage to get  
defaults from the db)

I tried adding

+columns => ['types.name']

but that didn't do anything. Any suggestions?

Regards,
Benjamin

_______________________________________________
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@...
Peter Rabbitson-2

Re: Re: ResultSet columns attribute broken?

Reply Threaded More More options
Print post
Permalink
Benjamin Schuster-Boeckler wrote:

>> Bernhard Graf wrote:
>>> Peter Rabbitson wrote:
>>>
>>>> Yes because you are looking at TODO tests, don't worry about those.
>>>> I was actually asking if your live development code works, not the
>>>> test suite. Once we confirm that we have fixed your problem we will
>>>> release another DBIC version.
>>>
>>> Ah, ok.
>>>
>>> So I did install and - YES - it works fine!
>>>
>>> Thanks for your patience. ;-)
>>
>> 0.08102 now on CPAN, includes the above fix.
>>
>> Cheers
>>
>
> I'm sorry to say, but I still get this error. I have the following query
> (from within Catalyst):
>
> $c->model('DB::Line')->search({ 'types.name' => {'!=', 'Connection'} },
>                                                         { join     =>
> [qw/ types /],
>                                                           prefetch =>
> [qw/ types /],
>                                                           select   =>
> [qw/me.name types.name/],
>                                                           distinct => 1,
>                                                           order_by =>
> [qw/types.name me.name/]
>                                                         }
>
> This used to work just fine, until 0.0810x. Now I get
>
> DBIx::Class::ResultSet::search(): Column type not loaded or not passed
> to new() prior to insert() on TMEditor::Model::DB::Line=HASH(0x2662620)
> trying to resolve relationship (maybe you forgot to call
> ->reload_from_storage to get defaults from the db)
>
> I tried adding
>
> +columns => ['types.name']
>
> but that didn't do anything. Any suggestions?
>

Please show me the class definition of both DB::Line and the types class.
I need to see column definitions and relationships.

_______________________________________________
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@...
Benjamin Schuster-Boeckler

Re: Re: ResultSet columns attribute broken?

Reply Threaded More More options
Print post
Permalink
On 1 May 2009, at 09:40, Peter Rabbitson wrote:

> Benjamin Schuster-Boeckler wrote:
>>> Bernhard Graf wrote:
>>>> Peter Rabbitson wrote:
>>>>
>>>>> Yes because you are looking at TODO tests, don't worry about  
>>>>> those.
>>>>> I was actually asking if your live development code works, not the
>>>>> test suite. Once we confirm that we have fixed your problem we  
>>>>> will
>>>>> release another DBIC version.
>>>>
>>>> Ah, ok.
>>>>
>>>> So I did install and - YES - it works fine!
>>>>
>>>> Thanks for your patience. ;-)
>>>
>>> 0.08102 now on CPAN, includes the above fix.
>>>
>>> Cheers
>>>
>>
>> I'm sorry to say, but I still get this error. I have the following  
>> query
>> (from within Catalyst):
>>
>> $c->model('DB::Line')->search({ 'types.name' => {'!=',  
>> 'Connection'} },
>>                                                        { join     =>
>> [qw/ types /],
>>                                                          prefetch =>
>> [qw/ types /],
>>                                                          select   =>
>> [qw/me.name types.name/],
>>                                                          distinct  
>> => 1,
>>                                                          order_by =>
>> [qw/types.name me.name/]
>>                                                        }
>>
>> This used to work just fine, until 0.0810x. Now I get
>>
>> DBIx::Class::ResultSet::search(): Column type not loaded or not  
>> passed
>> to new() prior to insert() on  
>> TMEditor::Model::DB::Line=HASH(0x2662620)
>> trying to resolve relationship (maybe you forgot to call
>> ->reload_from_storage to get defaults from the db)
>>
>> I tried adding
>>
>> +columns => ['types.name']
>>
>> but that didn't do anything. Any suggestions?
>>
>
> Please show me the class definition of both DB::Line and the types  
> class.
> I need to see column definitions and relationships.


Hi,

I tested reverting to older version yesterday and realised the problem  
also existed in 0.08099. But it definitely works fine in 0.08012.

Here are the classes:
DB::Line:
---------------
package TMEditor::Schema::Line;

use strict;
use warnings;

use base 'DBIx::Class';

__PACKAGE__->load_components("Core");
__PACKAGE__->table("line");
__PACKAGE__->add_columns(
   "auto_line",
   { data_type => "INT", default_value => undef, is_nullable => 0,  
size => 11 },
   "name",
   { data_type => "VARCHAR", default_value => "", is_nullable => 0,  
size => 50 },
   "source",
   {
     data_type => "VARCHAR",
     default_value => undef,
     is_nullable => 1,
     size => 10,
   },
   "notes",
   {
     data_type => "TEXT",
     default_value => undef,
     is_nullable => 1,
     size => 65535,
   },
   "colour",
   { data_type => "VARCHAR", default_value => undef, is_nullable => 1,  
size => 7 },
   "pattern",
   {
     data_type => "VARCHAR",
     default_value => undef,
     is_nullable => 1,
     size => 15,
   },
   "type",
   { data_type => "SMALLINT", default_value => 0, is_nullable => 0,  
size => 1 },
);
__PACKAGE__->set_primary_key("auto_line");


# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-04-09 20:03:05
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/D7zAsgG0utHRX9JYVWSCA

__PACKAGE__->has_many(stops => 'TMEditor::Schema::Stop', 'auto_line');
__PACKAGE__->has_many(distances => 'TMEditor::Schema::Distance',  
'auto_line');
__PACKAGE__->has_many(times => 'TMEditor::Schema::Timetable',  
'auto_line');
__PACKAGE__->has_many(alltimes => 'TMEditor::Schema::FullTimetable',  
'auto_line');
__PACKAGE__->belongs_to(types => 'TMEditor::Schema::LineTypes',  
{ 'foreign.type_id' => 'self.type' });

# You can replace this text with custom content, and it will be  
preserved on regeneration
1;
---------------

and DB::LineTypes:

---------------
package TMEditor::Schema::LineTypes;

use strict;
use warnings;

use base 'DBIx::Class';

__PACKAGE__->load_components("Core");
__PACKAGE__->table("line_types");
__PACKAGE__->add_columns(
   "type_id",
   { data_type => "SMALLINT", default_value => "", is_nullable => 0,  
size => 5 },
   "name",
   {
     data_type => "VARCHAR",
     default_value => undef,
     is_nullable => 1,
     size => 20,
   },
);
__PACKAGE__->set_primary_key("type_id");


# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-04-09 20:03:05
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HXq2HUrF82EnH96avEgBkw

__PACKAGE__->has_many(lines => 'TMEditor::Schema::Line',  
{ 'foreign.type' => 'self.type_id' });


# You can replace this text with custom content, and it will be  
preserved on regeneration
1;

---------------

_______________________________________________
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@...
Matt S Trout

Re: Re: ResultSet columns attribute broken?

Reply Threaded More More options
Print post
Permalink
On Fri, May 01, 2009 at 02:33:26PM +0200, Benjamin Schuster-Boeckler wrote:
> I tested reverting to older version yesterday and realised the problem  
> also existed in 0.08099. But it definitely works fine in 0.08012.

This isn't a problem, it's a bug in your code that DBIx::Class now picks up.

Please see the previous discussion on this subject.

--
        Matt S Trout         Catalyst and DBIx::Class consultancy with a clue
     Technical Director      and a commit bit: http://shadowcat.co.uk/catalyst/
 Shadowcat Systems Limited
  mst (@) shadowcat.co.uk        http://shadowcat.co.uk/blog/matt-s-trout/

_______________________________________________
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@...
Peter Rabbitson-2

Re: Re: ResultSet columns attribute broken?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Benjamin Schuster-Boeckler
Benjamin Schuster-Boeckler wrote:

> On 1 May 2009, at 09:40, Peter Rabbitson wrote:
>
>> Benjamin Schuster-Boeckler wrote:
>>>> Bernhard Graf wrote:
>>>>> Peter Rabbitson wrote:
>>>>>
>>>>>> Yes because you are looking at TODO tests, don't worry about those.
>>>>>> I was actually asking if your live development code works, not the
>>>>>> test suite. Once we confirm that we have fixed your problem we will
>>>>>> release another DBIC version.
>>>>>
>>>>> Ah, ok.
>>>>>
>>>>> So I did install and - YES - it works fine!
>>>>>
>>>>> Thanks for your patience. ;-)
>>>>
>>>> 0.08102 now on CPAN, includes the above fix.
>>>>
>>>> Cheers
>>>>
>>>
>>> I'm sorry to say, but I still get this error. I have the following query
>>> (from within Catalyst):
>>>
>>> $c->model('DB::Line')->search({ 'types.name' => {'!=', 'Connection'} },
>>>                                                        { join     =>
>>> [qw/ types /],
>>>                                                          prefetch =>
>>> [qw/ types /],
>>>                                                          select   =>
>>> [qw/me.name types.name/],
>>>                                                          distinct => 1,
>>>                                                          order_by =>
>>> [qw/types.name me.name/]
>>>                                                        }
>>>
>>> This used to work just fine, until 0.0810x. Now I get
>>>
>>> DBIx::Class::ResultSet::search(): Column type not loaded or not passed
>>> to new() prior to insert() on TMEditor::Model::DB::Line=HASH(0x2662620)
>>> trying to resolve relationship (maybe you forgot to call
>>> ->reload_from_storage to get defaults from the db)
>>>

Hi,

Matt got confused, this indeed seems like an interface inconsistency. We are
still trying to figure out if 080xx had the correct behavior, or if it was
dangerously indeterministic. For the time being add me.<pkcols> to +select
and you'll be fine.

_______________________________________________
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@...
Benjamin Schuster-Boeckler

Re: Re: ResultSet columns attribute broken?

Reply Threaded More More options
Print post
Permalink
On 22 May 2009, at 11:14, Peter Rabbitson wrote:

> Benjamin Schuster-Boeckler wrote:
>> On 1 May 2009, at 09:40, Peter Rabbitson wrote:
>>
>>> Benjamin Schuster-Boeckler wrote:
>>>>> Bernhard Graf wrote:
>>>>>> Peter Rabbitson wrote:
>>>>>>
>>>>>>> Yes because you are looking at TODO tests, don't worry about  
>>>>>>> those.
>>>>>>> I was actually asking if your live development code works, not  
>>>>>>> the
>>>>>>> test suite. Once we confirm that we have fixed your problem we  
>>>>>>> will
>>>>>>> release another DBIC version.
>>>>>>
>>>>>> Ah, ok.
>>>>>>
>>>>>> So I did install and - YES - it works fine!
>>>>>>
>>>>>> Thanks for your patience. ;-)
>>>>>
>>>>> 0.08102 now on CPAN, includes the above fix.
>>>>>
>>>>> Cheers
>>>>>
>>>>
>>>> I'm sorry to say, but I still get this error. I have the  
>>>> following query
>>>> (from within Catalyst):
>>>>
>>>> $c->model('DB::Line')->search({ 'types.name' => {'!=',  
>>>> 'Connection'} },
>>>>                                                       { join     =>
>>>> [qw/ types /],
>>>>                                                         prefetch =>
>>>> [qw/ types /],
>>>>                                                         select   =>
>>>> [qw/me.name types.name/],
>>>>                                                         distinct  
>>>> => 1,
>>>>                                                         order_by =>
>>>> [qw/types.name me.name/]
>>>>                                                       }
>>>>
>>>> This used to work just fine, until 0.0810x. Now I get
>>>>
>>>> DBIx::Class::ResultSet::search(): Column type not loaded or not  
>>>> passed
>>>> to new() prior to insert() on  
>>>> TMEditor::Model::DB::Line=HASH(0x2662620)
>>>> trying to resolve relationship (maybe you forgot to call
>>>> ->reload_from_storage to get defaults from the db)
>>>>
>
> Hi,
>
> Matt got confused, this indeed seems like an interface  
> inconsistency. We are
> still trying to figure out if 080xx had the correct behavior, or if  
> it was
> dangerously indeterministic. For the time being add me.<pkcols> to  
> +select
> and you'll be fine.
>

I was trying to do what you said, though I'm not entirely sure what  
you mean:

->search({ 'types.name' => {'!=', 'Connection'} },
                     { join     => [qw/ types /],
                     prefetch => [qw/ types /],
                     select   => [qw/me.name types.name/],
                     +select  => [qw/me.auto_line types.type_id/],
                     distinct => 1,
                     order_by => [qw/types.name me.name/]
                     } )

but I still get:
DBIx::Class::ResultSet::search(): Column type not loaded or not passed  
to new() prior to insert() on  
TMEditor::Model::DB::Line=HASH(0x9cd52d8) trying to resolve  
relationship (maybe you forgot to call ->discard_changes to get  
defaults from the db)

TBH, I don't really understand the source of the problem. What's going  
wrong here?

Thanks in advance,
Benjamin


_______________________________________________
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@...
Peter Rabbitson-2

Re: Re: ResultSet columns attribute broken?

Reply Threaded More More options
Print post
Permalink
Benjamin Schuster-Boeckler wrote:

> On 22 May 2009, at 11:14, Peter Rabbitson wrote:
>
>> Benjamin Schuster-Boeckler wrote:
>>> On 1 May 2009, at 09:40, Peter Rabbitson wrote:
>>>
>>>> Benjamin Schuster-Boeckler wrote:
>>>>>> Bernhard Graf wrote:
>>>>>>> Peter Rabbitson wrote:
>>>>>>>
>>>>>>>> Yes because you are looking at TODO tests, don't worry about those.
>>>>>>>> I was actually asking if your live development code works, not the
>>>>>>>> test suite. Once we confirm that we have fixed your problem we will
>>>>>>>> release another DBIC version.
>>>>>>>
>>>>>>> Ah, ok.
>>>>>>>
>>>>>>> So I did install and - YES - it works fine!
>>>>>>>
>>>>>>> Thanks for your patience. ;-)
>>>>>>
>>>>>> 0.08102 now on CPAN, includes the above fix.
>>>>>>
>>>>>> Cheers
>>>>>>
>>>>>
>>>>> I'm sorry to say, but I still get this error. I have the following
>>>>> query
>>>>> (from within Catalyst):
>>>>>
>>>>> $c->model('DB::Line')->search({ 'types.name' => {'!=',
>>>>> 'Connection'} },
>>>>>                                                       { join     =>
>>>>> [qw/ types /],
>>>>>                                                         prefetch =>
>>>>> [qw/ types /],
>>>>>                                                         select   =>
>>>>> [qw/me.name types.name/],
>>>>>                                                         distinct => 1,
>>>>>                                                         order_by =>
>>>>> [qw/types.name me.name/]
>>>>>                                                       }
>>>>>
>>>>> This used to work just fine, until 0.0810x. Now I get
>>>>>
>>>>> DBIx::Class::ResultSet::search(): Column type not loaded or not passed
>>>>> to new() prior to insert() on
>>>>> TMEditor::Model::DB::Line=HASH(0x2662620)
>>>>> trying to resolve relationship (maybe you forgot to call
>>>>> ->reload_from_storage to get defaults from the db)
>>>>>
>>
>> Hi,
>>
>> Matt got confused, this indeed seems like an interface inconsistency.
>> We are
>> still trying to figure out if 080xx had the correct behavior, or if it
>> was
>> dangerously indeterministic. For the time being add me.<pkcols> to
>> +select
>> and you'll be fine.
>>
>
> I was trying to do what you said, though I'm not entirely sure what you
> mean:
>
> ->search({ 'types.name' => {'!=', 'Connection'} },
>                     { join     => [qw/ types /],
>                     prefetch => [qw/ types /],
>                     select   => [qw/me.name types.name/],
>                     +select  => [qw/me.auto_line types.type_id/],
>                     distinct => 1,
>                     order_by => [qw/types.name me.name/]
>                     } )
>
> but I still get:
> DBIx::Class::ResultSet::search(): Column type not loaded or not passed
> to new() prior to insert() on TMEditor::Model::DB::Line=HASH(0x9cd52d8)
> trying to resolve relationship (maybe you forgot to call
> ->discard_changes to get defaults from the db)
>
> TBH, I don't really understand the source of the problem. What's going
> wrong here?
>

Currently all columns defining the relationship *must* be part of the select.
As I said it will be fixed, however there's no timeline, the code is not
trivial.

_______________________________________________
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@...
Felix Antonius Wilhelm Ostmann

Re: Re: ResultSet columns attribute broken?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Benjamin Schuster-Boeckler
Benjamin Schuster-Boeckler schrieb:

> On 22 May 2009, at 11:14, Peter Rabbitson wrote:
>
>> Benjamin Schuster-Boeckler wrote:
>>> On 1 May 2009, at 09:40, Peter Rabbitson wrote:
>>>
>>>> Benjamin Schuster-Boeckler wrote:
>>>>>> Bernhard Graf wrote:
>>>>>>> Peter Rabbitson wrote:
>>>>>>>
>>>>>>>> Yes because you are looking at TODO tests, don't worry about
>>>>>>>> those.
>>>>>>>> I was actually asking if your live development code works, not the
>>>>>>>> test suite. Once we confirm that we have fixed your problem we
>>>>>>>> will
>>>>>>>> release another DBIC version.
>>>>>>>
>>>>>>> Ah, ok.
>>>>>>>
>>>>>>> So I did install and - YES - it works fine!
>>>>>>>
>>>>>>> Thanks for your patience. ;-)
>>>>>>
>>>>>> 0.08102 now on CPAN, includes the above fix.
>>>>>>
>>>>>> Cheers
>>>>>>
>>>>>
>>>>> I'm sorry to say, but I still get this error. I have the following
>>>>> query
>>>>> (from within Catalyst):
>>>>>
>>>>> $c->model('DB::Line')->search({ 'types.name' => {'!=',
>>>>> 'Connection'} },
>>>>>                                                       { join     =>
>>>>> [qw/ types /],
>>>>>                                                         prefetch =>
>>>>> [qw/ types /],
>>>>>                                                         select   =>
>>>>> [qw/me.name types.name/],
>>>>>                                                         distinct
>>>>> => 1,
>>>>>                                                         order_by =>
>>>>> [qw/types.name me.name/]
>>>>>                                                       }
>>>>>
>>>>> This used to work just fine, until 0.0810x. Now I get
>>>>>
>>>>> DBIx::Class::ResultSet::search(): Column type not loaded or not
>>>>> passed
>>>>> to new() prior to insert() on
>>>>> TMEditor::Model::DB::Line=HASH(0x2662620)
>>>>> trying to resolve relationship (maybe you forgot to call
>>>>> ->reload_from_storage to get defaults from the db)
>>>>>
>>
>> Hi,
>>
>> Matt got confused, this indeed seems like an interface inconsistency.
>> We are
>> still trying to figure out if 080xx had the correct behavior, or if
>> it was
>> dangerously indeterministic. For the time being add me.<pkcols> to
>> +select
>> and you'll be fine.
>>
>
> I was trying to do what you said, though I'm not entirely sure what
> you mean:
>
> ->search({ 'types.name' => {'!=', 'Connection'} },
>                     { join     => [qw/ types /],
>                     prefetch => [qw/ types /],
>                     select   => [qw/me.name types.name/],
>                     +select  => [qw/me.auto_line types.type_id/],
>                     distinct => 1,
>                     order_by => [qw/types.name me.name/]
>                     } )
>
you have to quote the +select!


perl -MData::Dumper -we 'print Dumper({+select => undef});'
$VAR1 = {
          'select' => undef
        };

VS

perl -MData::Dumper -we 'print Dumper({"+select" => undef});'
$VAR1 = {
          '+select' => undef
        };

i dont know, if this will help in this case, but i think this is
important, i forget this often :-/

> but I still get:
> DBIx::Class::ResultSet::search(): Column type not loaded or not passed
> to new() prior to insert() on
> TMEditor::Model::DB::Line=HASH(0x9cd52d8) trying to resolve
> relationship (maybe you forgot to call ->discard_changes to get
> defaults from the db)
>
> TBH, I don't really understand the source of the problem. What's going
> wrong here?
>
> Thanks in advance,
> Benjamin
>
>
> _______________________________________________
> 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@...
>


--
Mit freundlichen Grüßen

Felix Antonius Wilhelm Ostmann
--------------------------------------------------
Websuche   Search   Technology   GmbH   &   Co. KG
Martinistraße 3  -  D-49080  Osnabrück  -  Germany
Tel.:   +49 541 40666-0 - Fax:    +49 541 40666-22
Email: [hidden email] - Website: www.websuche.de
--------------------------------------------------
AG Osnabrück - HRA 200252 - Ust-Ident: DE814737310
Komplementärin:     Websuche   Search   Technology
Verwaltungs GmbH   -  AG Osnabrück  -   HRB 200359
Geschäftsführer:  Diplom Kaufmann Martin Steinkamp
--------------------------------------------------


_______________________________________________
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@...
Peter Rabbitson-2

Re: Re: ResultSet columns attribute broken?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Benjamin Schuster-Boeckler
Benjamin Schuster-Boeckler wrote:

>> Bernhard Graf wrote:
>>> Peter Rabbitson wrote:
>>>
>>>> Yes because you are looking at TODO tests, don't worry about those.
>>>> I was actually asking if your live development code works, not the
>>>> test suite. Once we confirm that we have fixed your problem we will
>>>> release another DBIC version.
>>>
>>> Ah, ok.
>>>
>>> So I did install and - YES - it works fine!
>>>
>>> Thanks for your patience. ;-)
>>
>> 0.08102 now on CPAN, includes the above fix.
>>
>> Cheers
>>
>
> I'm sorry to say, but I still get this error. I have the following query
> (from within Catalyst):
>
> $c->model('DB::Line')->search({ 'types.name' => {'!=', 'Connection'} },
>                                                         { join     =>
> [qw/ types /],
>                                                           prefetch =>
> [qw/ types /],
>                                                           select   =>
> [qw/me.name types.name/],
>                                                           distinct => 1,
>                                                           order_by =>
> [qw/types.name me.name/]
>                                                         }
>
> This used to work just fine, until 0.0810x. Now I get
>
> DBIx::Class::ResultSet::search(): Column type not loaded or not passed
> to new() prior to insert() on TMEditor::Model::DB::Line=HASH(0x2662620)
> trying to resolve relationship (maybe you forgot to call
> ->reload_from_storage to get defaults from the db)
>
> I tried adding
>
> +columns => ['types.name']
>
> but that didn't do anything. Any suggestions?
>

This problem was finally fixed. Please try current trunk[1], and report
any problems.

Cheers

[1] http://dev.catalyst.perl.org/repos/bast/DBIx-Class/0.08/trunk/

_______________________________________________
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@...