summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/postgres.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-09-26 20:32:19 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-09-26 20:32:19 +0000
commitc13eb665aadc3fdba694a47f6ae268b64696c70f (patch)
tree97e0c2a3b4d7f4d7778f837343005dd6ed70b36f /lib/sqlalchemy/databases/postgres.py
parentff2a8f24f56bc345d6b15791d6f85caed41cc924 (diff)
downloadsqlalchemy-c13eb665aadc3fdba694a47f6ae268b64696c70f.tar.gz
- added "FETCH" to the keywords detected by Postgres to indicate a result-row holding
statement (i.e. in addition to "SELECT").
Diffstat (limited to 'lib/sqlalchemy/databases/postgres.py')
-rw-r--r--lib/sqlalchemy/databases/postgres.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py
index f5eaf47f2..78f05954b 100644
--- a/lib/sqlalchemy/databases/postgres.py
+++ b/lib/sqlalchemy/databases/postgres.py
@@ -189,10 +189,17 @@ def descriptor():
('host',"Hostname", None),
]}
+SELECT_RE = re.compile(
+ r'\s*(?:SELECT|FETCH)',
+ re.I | re.UNICODE)
+
class PGExecutionContext(default.DefaultExecutionContext):
def _is_server_side(self):
return self.dialect.server_side_cursors and self.is_select() and not re.search(r'FOR UPDATE(?: NOWAIT)?\s*$', self.statement, re.I)
+
+ def is_select(self):
+ return SELECT_RE.match(self.statement)
def create_cursor(self):
if self._is_server_side():