From c01558ae7f4af08acc523786e107ea5e2e214184 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 28 Mar 2014 16:32:11 -0400 Subject: - Fixed ORM bug where changing the primary key of an object, then marking it for DELETE would fail to target the correct row for DELETE. Then to compound matters, basic "number of rows matched" checks were not being performed. Both issues are fixed, however note that the "rows matched" check requires so-called "sane multi-row count" functionality; the DBAPI's executemany() method must count up the rows matched by individual statements and SQLAlchemy's dialect must mark this feature as supported, currently applies to some mysql dialects, psycopg2, sqlite only. fixes #3006 - Enabled "sane multi-row count" checking for the psycopg2 DBAPI, as this seems to be supported as of psycopg2 2.0.9. --- lib/sqlalchemy/dialects/postgresql/psycopg2.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/dialects/postgresql/psycopg2.py') diff --git a/lib/sqlalchemy/dialects/postgresql/psycopg2.py b/lib/sqlalchemy/dialects/postgresql/psycopg2.py index 099ddf03d..ac1770625 100644 --- a/lib/sqlalchemy/dialects/postgresql/psycopg2.py +++ b/lib/sqlalchemy/dialects/postgresql/psycopg2.py @@ -347,7 +347,7 @@ class PGDialect_psycopg2(PGDialect): supports_unicode_statements = False default_paramstyle = 'pyformat' - supports_sane_multi_rowcount = False + supports_sane_multi_rowcount = False # set to true based on psycopg2 version execution_ctx_cls = PGExecutionContext_psycopg2 statement_compiler = PGCompiler_psycopg2 preparer = PGIdentifierPreparer_psycopg2 @@ -393,6 +393,9 @@ class PGDialect_psycopg2(PGDialect): is not None self._has_native_json = self.psycopg2_version >= (2, 5) + # http://initd.org/psycopg/docs/news.html#what-s-new-in-psycopg-2-0-9 + self.supports_sane_multi_rowcount = self.psycopg2_version >= (2, 0, 9) + @classmethod def dbapi(cls): import psycopg2 -- cgit v1.2.1