
July 3rd, 2009, 04:34 PM
|
 |
manwich
|
|
Join Date: Oct 2003
Location: Canadanistan
|
|
|
Odd error between SELECT and DELETE
Over the last day or so one of our applications has gone haywire in conjunction with an MS exchange problem and flooded the database with excess attachments. [about 5GB worth] The application itself can't delete everything before running out of memory, I whipped up a query to remove the entries. The problem is that mySQL does not seem to be parsing through the whole query when I run the delete.
A simple count query to test runs fine:
Code:
SELECT COUNT(*)
FROM swticketposts po INNER JOIN swattachments att
ON po.ticketpostid = att.ticketpostid
INNER JOIN swattachmentchunks ch
ON att.attachmentid = ch.attachmentid
WHERE po.ticketid = 221404
AND po.ticketpostid != 439145;
and returns 228277.
A quick change to DELETE, like so:
Code:
DELETE
FROM swticketposts po INNER JOIN swattachments att
ON po.ticketpostid = att.ticketpostid
INNER JOIN swattachmentchunks ch
ON att.attachmentid = ch.attachmentid
WHERE po.ticketid = 221404
AND po.ticketpostid != 439145;
yields the error Quote: | /* SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INNER JOIN swattachments att ON po.ticketpostid = at */ |
I've tried backquoting the table aliases and ecapsulating the JOIN conditions in parentheses but it seems like the query is just being truncated after a certain number of characters, even when running it from the CLI.
Any ideas what's going on here?
Edit: almost forgot, version 5.0.37-log
__________________
Last edited by fubes2000 : July 3rd, 2009 at 04:40 PM.
|