FIX: GH Issue #333 "cursor.execute() with INSERT statement containing OUTPUT inserted + multiple VALUES entries does not raise IntegrityError" by gargsaumya · Pull Request #338 · microsoft/mssql-python

Pull Request Overview

This pull request fixes GitHub Issue #333, which addresses a bug where fetchall() does not properly raise IntegrityError when executing INSERT statements with OUTPUT clauses that violate integrity constraints. The fix adds error checking after the fetch operation to ensure errors are properly detected and raised.

Key Changes:

  • Added check_error() call after DDBCSQLFetchAll() in the fetchall() method to properly handle and raise errors returned by the fetch operation
  • This brings fetchall() into consistency with other DDBC binding calls throughout the codebase that use check_error() for error handling

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.