summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/base.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-08-29 16:35:02 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-08-29 16:35:02 -0400
commite4bc7d289477e22815f4c6ab86b3f0c1bf356e08 (patch)
treefdfe33b2ab7e5ef54b62877d4c17a56a401e23ed /lib/sqlalchemy/dialects/postgresql/base.py
parent87fd1e3260d957ae25c44cc2ac30ce97feb89b35 (diff)
downloadsqlalchemy-e4bc7d289477e22815f4c6ab86b3f0c1bf356e08.tar.gz
- move LIMIT/OFFSET rendering to be as bind parameters, for all backends
which support it. This includes SQLite, MySQL, Postgresql, Firebird, Oracle (already used binds with ROW NUMBER OVER), MSSQL (when ROW NUMBER is used, not TOP). Not included are Informix, Sybase, MaxDB, Access [ticket:805] - LIMIT/OFFSET parameters need to stay as literals within SQL constructs. This because they may not be renderable as binds on some backends.
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/base.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py
index 89769b8c0..768fbcb4d 100644
--- a/lib/sqlalchemy/dialects/postgresql/base.py
+++ b/lib/sqlalchemy/dialects/postgresql/base.py
@@ -374,11 +374,11 @@ class PGCompiler(compiler.SQLCompiler):
def limit_clause(self, select):
text = ""
if select._limit is not None:
- text += " \n LIMIT " + str(select._limit)
+ text += " \n LIMIT " + self.process(sql.literal(select._limit))
if select._offset is not None:
if select._limit is None:
text += " \n LIMIT ALL"
- text += " OFFSET " + str(select._offset)
+ text += " OFFSET " + self.process(sql.literal(select._offset))
return text
def get_select_precolumns(self, select):