diff options
Diffstat (limited to 'lib/sqlalchemy/databases/postgres.py')
-rw-r--r-- | lib/sqlalchemy/databases/postgres.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py index 2f4865e96..124242086 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: |