Skip Menu |
 

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

Report information
The Basics
Id: 120527
Status: new
Priority: 0/
Queue: DBIx-Class

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

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



Subject: IN (…) mishandles nested subqueries with bind parameters
Download (untitled) / with headers
text/plain 2.1k
Using multiple ResultSetcolumns with bind variables in an IN (…) via ->as_query treats the subqueries' bind parameters as if they were directly in the -in => […] list and wraps them in another layer of [ \%attr => $value ]. Reported by simbabque on IRC. Adding the following test case to t/search/subquery.t fails: { rs => $cdrs, search => { artistid => { '-in' => [ $art_rs->search({ name => 'Foo' }, { rows => 1 })->get_column( 'artistid' )->as_query, $art_rs->search({ name => 'Bar' }, { rows => 1 })->get_column( 'artistid' )->as_query, ], } }, sqlbind => \[ "( SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track FROM cd me WHERE artistid IN ( (SELECT me.artistid FROM artist me WHERE name = ? LIMIT ? ), (SELECT me.artistid FROM artist me WHERE name = ? LIMIT ?) ) )", [ { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'name' } => 'Foo' ], [ $ROWS => 1 ], [ { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'name' } => 'Bar' ], [ $ROWS => 1 ], ], }, with: BIND values differ { got => [ [ { dbic_colname => "artistid" }, [ { dbic_colname => "name", sqlt_datatype => "varchar", sqlt_size => 100 }, "Foo" ] ], [ { dbic_colname => "artistid" }, [ { sqlt_datatype => "integer" }, 1 ] ], [ { dbic_colname => "artistid" }, [ { dbic_colname => "name", sqlt_datatype => "varchar", sqlt_size => 100 }, "Bar" ] ], [ { dbic_colname => "artistid" }, [ { sqlt_datatype => "integer" }, 1 ] ] ], want => [ [ { dbic_colname => "name", sqlt_datatype => "varchar", sqlt_size => 100 }, "Foo" ], [ { sqlt_datatype => "integer" }, 1 ], [ { dbic_colname => "name", sqlt_datatype => "varchar", sqlt_size => 100 }, "Bar" ], [ { sqlt_datatype => "integer" }, 1 ], ] }


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.