Arbitrary SQL with Django and PostgreSQL caveat
Update:There's no work around other than mentioned in #3214. My previous suggestion was for a work around was false and a result of an error on my part. I have therefore edited the post to reflect this.
We haven't had the need for using arbitrary SQL in our application but this just changed when I was setting up automatic build and testing. I ran into a caveat: #3214. The title is somewhat misleading, the bug is really about the arbitrary SQL being mangled by Django without letting you know it.
It's all there in the ticket; dedicated developers, users needing it, patch, documentation and tests. And the reason for not accepting? Some backends doesn't handle multiple statement... I know SQLite and PostgreSQL does.
After spending some time both in Django source and on their site I eventually found out that running the SQL as Database-backend-specific SQL data doesn't mangle it. Unfortunately this information was not included in the documentation.
Even if sending a patch for #3214 won't be accepted, I'm sure documentation patches (for "Database-backend-specific SQL data" for instance) would be gladly accepted.