What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

I tried to post the following comment to this SO post and got the orange box saying An error occurred during comment submission.

It seems you cannot update a table from a trigger originated while updating the same table (understandably, mysql puts a lock on the table). But `ON UPDATE CASCADE` will anyway set the `parent_id` to `NULL`. So if an entry has a valid level (say 3) but its `parent_id` is null, it means that it is in fact a top level entry. Some tweaking might be required in the code - but I think you can rely on this behavior. If parent is null, it is the root no matter what the value of level is.

At first I thought it was network or proxy issue, but other test comments worked fine. When I tried to post that comment on other threads I got the same error. Then I tried to post it line by line and apparently the following line is the villain.

But `ON UPDATE CASCADE` will anyway set the `parent_id` to `NULL`. So if an entry has a valid level (say 3) but its `parent_id` is null, it means that it is in fact a top level entry.

From what I observed, you cannot post this as a comment to any post in SO or meta or SU. Interestingly, if I misspell `UPDATE` in the `ON UPDATE..` part, I can submit it - but I can't fix it by going back and editing the comment.

Did I find a bug in SO code-base.... what's the price for that?

Update: I originally tried with backticks - just now tried again without backticks; both are not working. As you can see, others are able to post the same comment on this thread, but not me :(

If it'd help, here is the source of the AJAX request, copied from Firebug:

comment=But+%60ON+UPDATE+CASCADE%60+will+anyway+set+the+%60parent_id%60+to+%60NULL%60.+So+if+an+entry+has+a+valid+level+(say+3)+but+its+%60parent_id%60+is+null%2C+it+means+that+it+is+in+fact+a+top+level+entry.&fkey=bbc7b45d69567d6869ffd0dbcd44e8e5

The response tab in Firebug is empty.

Update: I guess Jeff is right about the proxy trying to protect me: I cannot post the following either:

ON UPDATE CASCADE set parent_id  NULL

But I can post

ON UPDATE CASCADE will anyway set the parent_id  to NULL
share|improve this question
    
But ON UPDATE CASCADE will anyway set the parent_id to NULL. So if an entry has a valid level (say 3) but its parent_id is null, it means that it is in fact a top level entry. –  Grace Note Jun 9 '10 at 12:56
2  
It seems you cannot update a table from a trigger originated while updating the same table (understandably, mysql puts a lock on the table). But ON UPDATE CASCADE will anyway set the parent_id to NULL. So if an entry has a valid level (say 3) but its parent_id is null, it means that it is in fact a top level entry. Some tweaking might be required in the code - but I think you can rely on this behavior. If parent is null, it is the root no matter what the value of level is. –  Grace Note Jun 9 '10 at 12:58
    
I just posted this on the SO question myself (but subsequently deleted it, I'm not going to take credit for your work). Doesn't seem to be a problem. Is it still happening on your end (maybe a temporary thing)? Would you like me to post it anyway and just credit it to your name, until this gets sorted out? –  Grace Note Jun 9 '10 at 12:59
    
I can't still post the said comment here!! –  Amarghosh Jun 9 '10 at 13:35
    
Restarted the browser, cleared the cookies and cache and still not working :( –  Amarghosh Jun 9 '10 at 13:42
    
@ccomet there is nothing to take credit for - If you check my edit history there, you can see that I'm kinda learning mysql-syntax from him. Please post the original comment on that question if you can - you might wanna redirect the blames to me though :) –  Amarghosh Jun 9 '10 at 13:45
    
We help those who help themselves but help others by helping themselves help others. In other words, it is perfectly fine to learn things while answering someone's question. If anything, it promotes better growth in you while simultaneously being a potential to solve a problem. –  Grace Note Jun 9 '10 at 13:48
    
@ccomet Thanks for helping me help myself while helping others help themselves :) The original issue still remains. I can't post that comment anywhere.. it doesn't make any sense at all :( –  Amarghosh Jun 9 '10 at 13:59
    
@ccomet: Thank you, now I've got that song stuck in my head...again. ;) @Amarghosh: Works also perfectly fine for me, what browser are you using? –  Time Traveling Bobby Jun 9 '10 at 13:59
    
@Bobby Firefox 3.6.3 I can post any other comment; I just can't post this particular comment. Nor can I edit some other comment to make it this one and save it. Strange! –  Amarghosh Jun 9 '10 at 14:05
1  
@Amarghosh: Can you send this comment to f.e. a pastebin or any other website? –  Time Traveling Bobby Jun 9 '10 at 14:10
1  
@Bobby: yes, he just did. He posted it here! He's only experiencing the problem when posting a comment. –  Andreas Bonini Jun 9 '10 at 14:13
    
@Kop: How the heck did I miss that? oO' –  Time Traveling Bobby Jun 9 '10 at 14:15
    
ON UPDATE CASCADE will anyway set the parent_id to NULL –  Amarghosh Jun 10 '10 at 4:13
    
ON UPDATE CASCADE set parent_id NULL –  Amarghosh Jun 20 '10 at 5:10

1 Answer 1

up vote 3 down vote accepted

I think you have a proxy trying to "protect" you from SQL Injection.

Poorly.

share|improve this answer
    
It seems you're right - I've updated the question. I'll try from outside (I am currently behind office proxy) and post the results. –  Amarghosh Jun 10 '10 at 4:14
    
Just tried from outside - it is the proxy. But I thought proxies filter only incoming traffic :( –  Amarghosh Jun 20 '10 at 5:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .