Merge 'trunk' into 'count_distinct'
[dbsrgits/DBIx-Class.git] / t / count / in_subquery.t
CommitLineData
ff1393c7 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Data::Dumper;
7
8use Test::More;
9
10plan ( tests => 1 );
11
12use lib qw(t/lib);
13use DBICTest;
14use DBIC::SqlMakerTest;
15
16my $schema = DBICTest->init_schema();
17
18{
19 my $rs = $schema->resultset("CD")->search(
20 { 'artist.name' => 'Caterwauler McCrae' },
21 { join => [qw/artist/]}
22 );
23 my $squery = $rs->get_column('cdid')->as_query;
24 my $subsel_rs = $schema->resultset("CD")->search( { cdid => { IN => $squery } } );
25 is($subsel_rs->count, $rs->count, 'Subselect on PK got the same row count');
26}