diff --git a/frappe/database/database.py b/frappe/database/database.py index 71450b60e37f..9e4c159df155 100644 --- a/frappe/database/database.py +++ b/frappe/database/database.py @@ -226,6 +226,9 @@ def sql( try: self._cursor.execute(query, values) except Exception as e: + if self.db_type == "postgres": + frappe.db.rollback() + if self.is_syntax_error(e): frappe.log(f"Syntax error in query:\n{query} {values or ''}")