An error occurred when trying to include code with a DROP statement in SQL

I've actually seen this in chat before, but never when posting an answer.

I was trying to post an answer a minute ago, and as part of the SQL script I posted I included some "clean up" code, which DROPs the objects I created in the script. I, however, was unable to post the post with these DROP statements, even as a mod.

When trying to submit the answer, or edit, I get a similar error:

An error occurred submitting the answer.
An image show the end of the SQL script in a code fence with some DROP statements, and the error above
An error occurred submitting the edit.
An image show the end of the SQL script with some DROP statements, and the error above

Removing the two DROP statements allows me to submit the content.

A similar error occurs if I attempt to submit the code in a message (DROP statements omitted in linked message) in chat:

An unknown error has occurred - retry / edit / cancel
An image showing the code from my answer attempting to be sent in chat, and failing, with the error above. The 3 options at the end are actionable links

Again, removing the DROP statements allows the message to be sent.

I assume this is some kind of over zealous SQL injection protection, attempting to stop DROP statements being issued to the database. Considering, however, the DROP statements are likely to be a common statement, and Stack's input should be well parametrised. Blocking valid code, on a website about code is not ideal.

Can this be investigated and fixed, please?

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论