[Dbix-class] bugs? distinct SQL

Matt S Trout dbix-class at trout.me.uk
Tue May 6 19:47:26 BST 2008


On Tue, May 06, 2008 at 09:52:46AM +0800, Fayland Lam wrote:
>    my @ips = $c->dbic_log->resultset('login_history')->search( {
>    }, {
>        select => [
>            { distinct => [ 'user_id','IP' ] }
>        ],
>        as => [ 'user_id','IP' ]
>    }
>    )->all;
> 
> will create SQL:
> 
> DBD::mysql::st execute failed: Operand should contain 1 column(s) [for 
> Statement "SELECT DISTINCT( user_id, IP ) FROM login_history me"]
> 
> which in mysql:
> mysql>  SELECT DISTINCT( user_id, IP ) FROM login_history limit 1;
> ERROR 1241 (21000): Operand should contain 1 column(s)
> mysql>  SELECT DISTINCT user_id, IP FROM login_history limit 1;
> +---------+----------------+
> | user_id | IP             |
> +---------+----------------+
> | 15538534 | 220.238.87.172 |
> +---------+----------------+
> 1 row in set (0.18 sec)
> 
> with (), mysql will complaint.  version is 5.0.24a.
> 
> any hint? Thanks.

Known bug. Patch and/or test welcome.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list