]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- added "FETCH" to the keywords detected by Postgres to indicate a result-row holding
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 26 Sep 2007 20:32:19 +0000 (20:32 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 26 Sep 2007 20:32:19 +0000 (20:32 +0000)
  statement (i.e. in addition to "SELECT").

CHANGES
lib/sqlalchemy/databases/postgres.py

diff --git a/CHANGES b/CHANGES
index a468ccc096aa2b063eac2a7e2a079b67c12ed16d..bdb2cd995204ce185c3acc4827e275430d43b89c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -19,6 +19,9 @@ CHANGES
   inheritance relationships need to be constructed in inheritance order
   (which should be the normal case anyway).
 
+- added "FETCH" to the keywords detected by Postgres to indicate a result-row holding 
+  statement (i.e. in addition to "SELECT").
+
 - Added full list of SQLite reserved keywords so that they get escaped
   properly.
 
index f5eaf47f21367650ace9fb89ad7d8c6714f5ea88..78f05954b00671b2b2511366751e0cdb91253d5c 100644 (file)
@@ -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():