﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31320	Prevent BEGIN and COMMIT in RunSQL in atomic migrations.	Adam Johnson	nobody	"Migrations are `atomic` by default, which means they use a transaction on backends that support them (PostgreSQL).

`RunSQL` allows running arbitrary SQL, including `BEGIN` / `COMMIT` which break the atomic transaction handling.

PostgreSQL will warn about `BEGIN` within a transaction ( https://www.postgresql.org/docs/current/sql-begin.html ) but this warning won't be displayed on a standard Django setup. Equally it will warn about a `COMMIT` when no transaction is running.

(SQLite at least raises an error for a `BEGIN` within a transaction).

Beginners to the migration framework can miss that migrations are 'atomic' by default, and use their SQL knowledge to write `BEGIN`/`COMMIT`, not realizing they're actually breaking the transactional integrity of their migrations.

It would be good to detect this and refuse to run such `RunSQL` operations."	New feature	closed	Migrations	dev	Normal	wontfix		Simon Charette	Unreviewed	0	0	0	0	0	0
