From be818baf28aac68fbb7934881b4539cb08e9aaa2 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 17 Jun 2008 15:15:16 +0000 Subject: [PATCH] merged r4857, postgres server_side_cursors fix, from 0.4 branch --- CHANGES | 4 ++++ lib/sqlalchemy/databases/postgres.py | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 5441a14707..377690e55d 100644 --- a/CHANGES +++ b/CHANGES @@ -83,6 +83,10 @@ CHANGES Totally unrelated types, or subtypes not set up with mapper inheritance against the target mapper are still not allowed. + +- postgres + - Repaired server_side_cursors to properly detect + text() clauses. - mysql - Added 'CALL' to the list of SQL keywords which return diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py index 2f4865e96e..1242420864 100644 --- a/lib/sqlalchemy/databases/postgres.py +++ b/lib/sqlalchemy/databases/postgres.py @@ -278,7 +278,10 @@ class PGExecutionContext(default.DefaultExecutionContext): self.dialect.server_side_cursors and \ ((self.compiled and isinstance(self.compiled.statement, expression.Selectable)) \ or \ - (not self.compiled and self.statement and SERVER_SIDE_CURSOR_RE.match(self.statement))) + ( + (not self.compiled or isinstance(self.compiled.statement, expression._TextClause)) + and self.statement and SERVER_SIDE_CURSOR_RE.match(self.statement)) + ) if self.__is_server_side: # use server-side cursors: -- 2.47.3