[Dbix-class] SQLA bug with >>= operator

Toby Corkindale toby.corkindale at strategicdata.com.au
Thu Apr 22 02:02:16 GMT 2010


I  think this is actually an SQL::Abstract bug, but the SQLA docs say to 
try the dbic mailing lists for support, so..


Steps to reproduce under SQL::Abstract:
my $sql = SQL::Abstract->new;
my($stmt, @bind) = $sql->select('foo', 'foo', {
         address => { '>>=' => '10.2.3.4' },
     }
);

$stmt contains:
SELECT foo FROM foo WHERE ( address = >>=( ? ) )
what it *should* contain:
SELECT foo FROM foo WHERE ( address >>= ? )



Steps to reproduce under DBIx::Class:
CREATE TABLE foo(address INET);

$schema->resultset('Foo')->search(
   {
     address => { '>>=' => '10.1.2.3.' }
   }
)->next;


Generated SQL:
SELECT me.id, me.address FROM foo me WHERE ( address = >>=( ? ) ): 
'10.1.2.3'

SQL error:
DBD::Pg::st execute failed: ERROR:  operator does not exist: >>=


What the SQL should have been:
SELECT me.id, me.address FROM foo me WHERE ( address >>= ? ): '10.1.2.3'



Cheers,
Toby



More information about the DBIx-Class mailing list