Skip Menu |

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

Report information
The Basics
Id: 126958
Status: open
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: KES [...] cpan.org
Cc:
AdminCc:

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



Subject: Unclear error
DBIx::Class::ResultSet::_resolved_attrs(): Unable to prefetch, resultset contains an unnamed selector {exists => \["(SELECT 1 FROM \"service_package_set\" \"partial\" WHERE ( ( \"service_type_id_covered\" = \"ServiceTree\".\"id\" OR \"service_type_id_surplus\" = \"ServiceTree\".\"id\" ) ))"]} at (eval 2343)[/home/kes/perl5/perlbrew/perls/perl-5.24.1/lib/site_perl/5.24.1/DB/Commands.pm:971] line 3 After this error I have tried to add an 'alias': my $partial = $c->model( 'ServicePackageSet' )->search([ { service_type_id_covered => { -ident => 'ServiceTree.id' } }, { service_type_id_surplus => { -ident => 'ServiceTree.id' } }, ],{ select => \1, alias => 'partial' }); This change nothing. After googling a bit I have found: https://www.perlmonks.org/?node_id=882510 and change my resulting query as: my $pricelist = $c->model( 'ServiceTree' )->search({ },{ prefetch => [qw/ Price Package /], '+select' => { exists => $partial->as_query }, '+as' => [ 'abc' ], ## <<<<<<<< HERE order_by => [qw/ Package.short_name name /], }); The error message should be improved to be meaningful. It should explicitly say: maybe you should use `+as`....
Subject: Re: [rt.cpan.org #126958] Unclear error
Date: Sun, 26 Aug 2018 15:20:28 +0200
To: bug-DBIx-Class [...] rt.cpan.org
From: Peter Rabbitson <ribasushi [...] leporine.io>
On 08/26/2018 03:05 PM, Eugen Konkov via RT wrote: Show quoted text
> > DBIx::Class::ResultSet::_resolved_attrs(): Unable to prefetch, resultset contains an unnamed selector {exists => \["(SELECT 1 FROM \"service_package_set\" \"partial\" WHERE ( ( \"service_type_id_covered\" = \"ServiceTree\".\"id\" OR \"service_type_id_surplus\" = \"ServiceTree\".\"id\" ) ))"]} at (eval 2343)[/home/kes/perl5/perlbrew/perls/perl-5.24.1/lib/site_perl/5.24.1/DB/Commands.pm:971] line 3 > > ... > > The error message should be improved to be meaningful. It should explicitly say: maybe you should use `+as`.... >
Could you propose a complete sentence that would read correctly to you? I am aware you are not a native english speaker: this is ok. I need to see where you would add the proposed bit, as it is not clear to me where it would be most effective.
The error message above point the problem pretty sharp. It was not clear how to resolve the issue. I try to suggest postgresql way. It report the problem and a hint how to resolve/fix this problem. So we can extend error message with next hint: <error message> HINT: Name your selector by using '+as' keyword