Re: Limit with IN operator and empty VALUES results in invalid SQL queries
Alex Vandiver <[email protected]> Wed, 10 Dec 2014 13:49:22 -0500
| Newsgroups | gmane.comp.bug-tracking.request-tracker.devel |
|---|---|
| Organization | Best Practical Solutions, LLC |
| Message-ID | <[email protected]> |
On 12/10/2014 04:46 AM, Christian Loos wrote: >> yesterday I saw some invalid MySQL queries in my logs: >> [snip] > > I changed > $self->Limit( FIELD => 'Id', OPERATOR => 'IN', VALUE => \@match ); > to > $self->Limit( FIELD => 'Id', OPERATOR => 'IN', VALUE => @match ? \@match > : [0] ); > which fixes the bug for me. > > It would be great if one of the developers can review this and give some > feedback. Sorry -- this was flagged on my "should look at" but I'd not gotten to it. I've pushed 4.2/empty-in-clause with a similar-looking change. > I'm not sure if this should only be fixed in RT or if this should be > fixed in DBIx::SearchBuilder (always generate valid SQL even if the > provided VALUE is an empty list). It's hard to decide if DBIx::SearchBuilder should apply no limit, or apply a never-match limit in such cases. RT has cases of each. - Alex