[Dbix-class] Using update on a resultset with join

Rob Kinyon rob.kinyon at gmail.com
Thu May 6 20:41:37 GMT 2010


On Thu, May 6, 2010 at 16:35, Matt S Trout <mst at shadowcat.co.uk> wrote:
> On Wed, May 05, 2010 at 12:24:18PM +0200, Peter Rabbitson wrote:
>> > Whereas I was expecting SQL like:
>> > UPDATE foo me JOIN ( bars bar ON bars.id = me.bar_id ) SET me.exported =
>> > 1 WHERE ( me.exported = 0 AND bar.state = 'WA' )
>> >
>>
>> Newer versions address this issue, albeit not with the SQL you proposed
>> (I am not aware of any RDBMS which will execute the above sanely - i.e.
>> *really* restrict the update-able set with the join). In any case -
>> simply upgrade.
>
> It's called PostgreSQL. Here's a dollar, MySQL boy, get yourself a real
> database.

MySQL will allow updates on joins in exactly that fashion and with
that exact SQL.

Here's your F**ing dollar back, PG-boi. :)

Rob



More information about the DBIx-Class mailing list