Skip Menu |
 

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

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

People
Owner: ribasushi [...] leporine.io
Requestors: abraxxa [...] cpan.org
koenc [...] dalicon.com
Cc: gortan [...] cpan.org
AdminCc:

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



Subject: relationship where attrs are ignored when prefetching a rel
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 555
Download (untitled) / with headers
text/plain 555b
When prefetching this relationship the where attribute is ignored while it is used when calling $row->currently_affected_by_maintenance without prefetch: __PACKAGE__->has_many('currently_affected_by_maintenance', 'NAC::Model::DBIC::Table::View_Interface_Affected_By_Maintenance', 'fk_interface', { join => 'rel_maintenance', where => { 'rel_maintenance.datetime_start' => \'<= sys_extract_utc(SYSTIMESTAMP)', 'rel_maintenance.datetime_end' => \'>= sys_extract_utc(SYSTIMESTAMP)', }, } );
From koenc [...] dalicon.com Tue Aug 23 08: 59:46 2011
CC: "'K. Cuelenaere'" <koenc [...] dalicon.com>
MIME-Version: 1.0
X-Spam-Status: No, score=-6.899 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5] autolearn=ham
X-Spam-Flag: NO
X-Cloudmark-Analysis: v=1.1 cv=7AjrSHUygkxmgKj9+ZdWPzZoKYzIcpgZMIt1Yxqn8hE= c=1 sm=0 a=xbE4DZ5lDHsA:10 a=Zm6RFStWugMA:10 a=n17s7KcRzzEA:10 a=M-o9CEOXAAAA:8 a=jp6LfL1ilnee1_nyV2UA:9 a=G3q-ztDLgS02YBe5iPsA:7 a=QEXdDO2ut3YA:10 a=AG8Orbvq-_UA:10 a=-572LEFt_6cA:10 a=euLXFYxemlTsfxG_:21 a=OL-X3K8evsUJr3G8:21 a=c6kf8iSOC2qVzQ-HzS0A:7 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117
X-Virus-Checked: Checked by ClamAV on 16.mx.develooper.com
Content-Type: multipart/alternative; boundary="------------090206040100050800040901"
Message-ID: <4E53A41D.4050804 [...] dalicon.com>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Spam-Score: -6.899
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id E2A25240096 for <cpan-bug+dbix-class [...] hipster.bestpractical.com>; Tue, 23 Aug 2011 08:59:46 -0400 (EDT)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GRGULAmXnX65 for <cpan-bug+dbix-class [...] hipster.bestpractical.com>; Tue, 23 Aug 2011 08:59:45 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id EEE9224007B for <bug-dbix-class [...] rt.cpan.org>; Tue, 23 Aug 2011 08:59:44 -0400 (EDT)
Received: (qmail 12535 invoked by uid 103); 23 Aug 2011 12:59:44 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 23 Aug 2011 12:59:44 -0000
Received: from fep19.mx.upcmail.net (HELO fep19.mx.upcmail.net) (62.179.121.39) by 16.mx.develooper.com (qpsmtpd/0.80/v0.80-19-gf52d165) with ESMTP; Tue, 23 Aug 2011 05:59:39 -0700
Received: from edge05.upcmail.net ([192.168.13.212]) by viefep19-int.chello.at (InterMail vM.8.01.02.02 201-2260-120-106-20100312) with ESMTP id <20110823125934.GBSS22360.viefep19-int.chello.at [...] edge05.upcmail.net>; Tue, 23 Aug 2011 14:59:34 +0200
Received: from [10.0.1.123] ([95.97.92.196]) by edge05.upcmail.net with edge id PozY1h01Y4EBnwF05ozZM9; Tue, 23 Aug 2011 14:59:34 +0200
Delivered-To: cpan-bug+dbix-class [...] hipster.bestpractical.com
Subject: "where" attribute for DBIx::Class::RelationShip does no longer seem to be functional
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7
Return-Path: <koenc [...] dalicon.com>
X-RT-Mail-Extension: dbix-class
X-Original-To: cpan-bug+dbix-class [...] hipster.bestpractical.com
X-Spam-Check-BY: 16.mx.develooper.com
Date: Tue, 23 Aug 2011 14:59:09 +0200
X-Spam-Level:
X-Sourceip: 95.97.92.196
To: bug-DBIx-Class [...] rt.cpan.org
From: Koen Cuelenaere <koenc [...] dalicon.com>
Content-Length: 0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-RT-Original-Encoding: utf-8
Content-Length: 2101
Hi there, according to the documentation we should be able to in the Relationship class, use the "where" attribute for filtering relationships. I've tried to do that in the latest DBIx::Class version (0.08195) and it doesn't work, nor do I see the code looking out for that "where" attribute. It results in SQL where the filter has not been applied to, so returns incorrect results. This is the definition that I try to do: __PACKAGE__->has_many( "articles_has_article_galleys_pdf", "pharmaventures::Storage::Schema::OJS::ArticleGalleys", { "foreign.article_id" => "self.article_id", # "foreign.label" => \"pdf" }, { join_type => 'left', where => { label => "pdf" } } ); PS: mind the commented line: in an earlier version of DBIx::Class I succesfully made a patch that uses a string ref as an alternative way of filtering the relationship. That code is now harder to reimplement in the latest DBIx::Class code alas. regards Koen -- ---------------------------------------------------------- Please be informed that as of January 1st 2011 Dalicon has a new visiting address and telephone number. Koen Cuelenaere, MSc Dalicon BV P.O. Box 354 Tel: +31 (0) 317 479 760 6700 AJ Wageningen Fax: +31 (0) 317 479 666 Mobile: +31 (0) 653 325 402 Visiting address Agro Business Park 26 6708 PW Wageningen The Netherlands http://www.dalicon.com/ Email: K.Cuelenaere@dalicon.com --------------------------------------------------------- The contents of this message, as well as any enclosures, are addressed personally to, and thus solely intended for the addressee. They may contain information regarding a third party. A recipient who is neither the addressee, nor empowered to receive this message on behalf of the addressee, is kindly requested to immediately inform the sender of receipt. Any use of the contents of this message and/or of the enclosures by any other person than the addressee is illegal towards the sender and the aforementioned third party.
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-RT-Original-Encoding: utf-8
Content-Length: 2980
MIME-Version: 1.0
In-Reply-To: <4E53A41D.4050804 [...] dalicon.com>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
References: <4E53A41D.4050804 [...] dalicon.com>
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-20565-1314846165-1622.70439-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 2627
Download (untitled) / with headers
text/plain 2.5k
On Tue Aug 23 08:59:47 2011, koenc@dalicon.com wrote: Show quoted text
> Hi there,
Hi! (and sorry for the untimely reply) Show quoted text
> according to the documentation we should be able to in the > Relationship class, use the "where" attribute for filtering > relationships. I've tried to do that in the latest DBIx::Class > version (0.08195) and it doesn't work, nor do I see the code > looking out for that "where" attribute. It results in > SQL where the filter has not been applied to, so returns > incorrect results. > > This is the definition that I try to do: > > __PACKAGE__->has_many( > "articles_has_article_galleys_pdf", > "pharmaventures::Storage::Schema::OJS::ArticleGalleys", > { > "foreign.article_id" => "self.article_id", > # "foreign.label" => \"pdf" > }, > { join_type => 'left', > where => { > label => "pdf" > } > } > ); > > PS: mind the commented line: in an earlier version > of DBIx::Class I succesfully made a patch that uses > a string ref as an alternative way of filtering the > relationship. That code is now harder to reimplement > in the latest DBIx::Class code alas. >
You have several unrelated things here, so I will try to deconstruct: 1) A left join with a where clause makes no sense (it will *never* do what you expect it to do). Consider: SELECT * FROM artists a LEFT JOIN cds c ON a.id = c.cd_id WHERE c.year = 2000 vs SELECT * FROM artists a LEFT JOIN cds c ON a.id = c.cd_id AND c.year = 2000 Based on the things you gave above you seem to understand this, so perhaps the only confusion is that you assumed where will translate to an ON clause - this is not the case: a where is a where 2) You did not show your invocation, but I suspect the where was "ignored" during prefetch (not during a search_related call). If this is the case this looks like a bug duplicate of https://rt.cpan.org/Ticket/Display.html?id=63709. If this is the case it is an (obviously) known issue, with an annoyingly involved fix. Due to the limited utility of the where attr, this bug has not been as of yet fixed. 3) On your local patch of dbic to use stringrefs - istr you submitting something similar to the ML which was rejected with a good reason (or maybe it wasn't you, anyhow). The correct way to do this in recent versions is through a coderef condition specification as described in detail here: http://search.cpan.org/~abraxxa/DBIx-Class-0.08195/lib/DBIx/Class/Relationship/Base.pm#condition (look for the paragraph "To specify joins which describe more than a simple equality...") Let me know your thought on the above points. Cheers
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-6895-1322135813-1791.63709-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 10
Lower prio
MIME-Version: 1.0
In-Reply-To: <4E53A41D.4050804 [...] dalicon.com>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
References: <4E53A41D.4050804 [...] dalicon.com>
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-10497-1322135889-1268.70439-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 132
Download (untitled) / with headers
text/plain 132b
Stalling ticket - no reply from OP, and it's almost certain it is a duplicate. Adding a link to the seemingly related issue instead.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-29646-1397049868-481.63709-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 202
Download (untitled) / with headers
text/plain 202b
Just an update for everyone watching - this is an acknowledged bug and needs fixing. I am looking into this subsystem today, maybe something will fall out as a result. Apologies for the massive delay :(
MIME-Version: 1.0
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-30702-1409815323-1873.63709-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 274
Download (untitled) / with headers
text/plain 274b
Another update - the feature had to go again on the back burner. There is now a clear path forward on how to solve this, but the complications with the current RC are forcing me to reschedule solving this towards end of September. Apologies for the delay to all involved :(
X-Recommended-Action: accept
MIME-Version: 1.0
X-Geenspammx-Domain: site4u.nl
X-Spam-Flag: NO
X-Filter-ID: s0sct1PQhAABKnZB5plbIV9SPAhh0CU/lVKaT5vKZGV+oesNUY2G5KfBH9a7fQiC559+Fc1DnVzH j6YaOREB4FzyFr8OUi3/xEhcgWsBQ7kwn5GQbLJfoegShcshIz4alzwlcoXspOzlHYf67B1AXuva 19jcAK4EljfCRkOlyaGAEPztoLy9RCI6Ashbnuz2TdiSp628SHG21ZADbORyGgO08aA3RTsBhDTD acA6NHOZ2nvEMlp67MOu8LHlK4wfl5yM4mc60BfzX8mEAgXT6SQp18CZegSCp4hfJmCQ5SzfrP9o TTJ3p7ClZs06wSrgGGlyyYdHvIKTS+/nWd2rGKMphba6ySqMNdXTOsAQTL6LBDMrD7q/cJogwbqz suokTLq4c1F5CFDo/ws4apkA/wapZHOF6tVy2yjgbVvl61seeX8kuuSsAk6ZNhG2BAMvoC7iBNK5 mwaINxGwvcQ9qlPRWj3SLj++6yK+2sMqIxzNtwWYPZ02zZhBIynew9nRq7gAN4A3ElygX+m/2hhp OOE4u3W5o/z6Aa1izCDcGpUamUdylUIKhf3z2GAHxH7IZDvENZ+2md4ycP615NrLFgy3APFdH8QZ 6cWZoNdpTDr5SNjS14s7aIXxN6b5hvpbY3t5zQgfEN4rBvyq633GJg==
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
content-type: text/plain; charset="utf-8"; format="flowed"
X-RT-Original-Encoding: utf-8
X-Spam-Score: -5.9
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 806DA2403A6 for <cpan-bug+DBIx-Class [...] hipster.bestpractical.com>; Mon, 15 Sep 2014 06:43:03 -0400 (EDT)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NjHe19do9EIk for <cpan-bug+DBIx-Class [...] hipster.bestpractical.com>; Mon, 15 Sep 2014 06:43:01 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 782AC24031B for <bug-DBIx-Class [...] rt.cpan.org>; Mon, 15 Sep 2014 06:43:00 -0400 (EDT)
Received: (qmail 11363 invoked by alias); 15 Sep 2014 10:42:57 -0000
Received: from xenia.geenspam.mx (HELO xenia.geenspam.mx) (78.31.117.202) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Mon, 15 Sep 2014 03:42:54 -0700
Received: from utopian.site4u.nl ([78.31.117.222]) by xenia.geenspam.mx with esmtp (Exim 4.82) (envelope-from <koenc [...] dalicon.nl>) id 1XTTk1-0002cn-Hu for bug-DBIx-Class [...] rt.cpan.org; Mon, 15 Sep 2014 12:42:49 +0200
Received: by utopian.site4u.nl (Postfix, from userid 33) id 6693781445; Mon, 15 Sep 2014 12:42:38 +0200 (CEST)
X-Filter-Fingerprint: IFrWXGses7OKB5S5G8/dJR8Z5VD7FZiiT9tK6RAzQuhA3cTUQ1R++keuE7RDJ8Kg3RbMLUalw1oC mj99/u+PoqoVy8a3lsStJtAvpObFX0W9pwnCLfzqMQ4SqlQant4mUpndEJ0YoaLytXXo8BMTaX2p Mk7LBarWD9Fj4R3eIu5cOy/3Wm9qfF/CZNvP/2Kowv61T+KDYyYtREgszdyFwv8IxCB3p/oCKvxr eyISh3JGb7OS5oVgiO+kDxZrVPLz3MmEGC2PrUKqLq5WmHK+Nw==
Authentication-Results: geenspam.mx; auth=pass smtp.auth=78.31.117.222
Delivered-To: cpan-bug+DBIx-Class [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #63709] relationship where attrs are ignored when prefetching a rel
X-Spam-Check-BY: la.mx.develooper.com
Date: Mon, 15 Sep 2014 12:42:38 +0200
X-Geenspammx-Outgoing-Class: ham
X-Spam-Level:
X-PHP-Originating-Script: 501:rcube.php
To: bug-DBIx-Class [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
X-Geenspammx-Username: 78.31.117.222
X-Report-Abuse-To: spam [...] xenia.geenspam.mx
X-Sender: koenc [...] dalicon.nl
In-Reply-To: <rt-4.0.18-30702-1409815325-28.63709-6-0 [...] rt.cpan.org>
X-Spam-Status: No, score=-5.9 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, FROM_OUR_RT=-4] autolearn=ham
X-RT-Interface: API
References: <RT-Ticket-63709 [...] rt.cpan.org> <rt-4.0.18-30702-1409815325-28.63709-6-0 [...] rt.cpan.org>
Message-ID: <3854e7b5bb9048f82d12cc9171fff548 [...] dalicon.nl>
X-Geenspammx-Outgoing-Evidence: Combined (0.00)
User-Agent: Roundcube Webmail/1.0.1
Return-Path: <koenc [...] dalicon.nl>
X-RT-Mail-Extension: dbix-class
X-Original-To: cpan-bug+DBIx-Class [...] hipster.bestpractical.com
X-Originating-Ip: 78.31.117.222
From: Koen Cuelenaere <koenc [...] dalicon.nl>
RT-Message-ID: <rt-4.0.18-25312-1410777784-1182.63709-0-0 [...] rt.cpan.org>
Content-Length: 483
Download (untitled) / with headers
text/plain 483b
On 04.09.2014 09:22, Peter Rabbitson via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=63709 > > > Another update - the feature had to go again on the back burner. There > is now a clear path forward on how to solve this, but the > complications with the current RC are forcing me to reschedule solving > this towards end of September. > > Apologies for the delay to all involved :(
Hi there; no worries. We found a workaround. thanks for the updates though. Koen


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.