[Dbix-class] calling delete in a resultset with a join
Zbigniew Lukasiak
zzbbyy at gmail.com
Sun Dec 2 13:51:19 GMT 2007
Hi Jonas,
On Nov 29, 2007 11:35 AM, Jonas Alves <jonas.alves at gmail.com> wrote:
> Hello all,
>
> I', triyng to call delete in a resultset with a join. like this:
>
> $schema->resultset('Movie')->search(
> { 'category.update_flag' => 'old' },
> { join => 'category' }
> )->delete;
>
>
> The SQL I'm getting is:
>
> DELETE FROM movie WHERE ( update_flag = ? ): 'old'
>
> And I was expecting something like:
>
> DELETE FROM movie LEFT JOIN category WHERE ( category.update_flag = ? ): 'old'
Are you sure that is the right syntax? The PostgreSQL tutorial
suggest another form:
DELETE FROM films USING producers
WHERE producer_id = producers.id AND producers.name = 'foo';
http://www.postgresql.org/docs/8.3/static/sql-delete.html
Cheers,
Zbyszek
http://perlalchemy.blogspot.com
More information about the DBIx-Class
mailing list