summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2018-10-23 01:06:24 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2018-10-23 01:57:48 +0100
commit8fb0f694f755a5c1bfdd67f923ec43be3c0d34b5 (patch)
tree004da29b7091b6fcab16c619e19a92162c9c67b6 /lib
parent05f9e231a0aafed57b1f38ad6a1e6a5838b05cc5 (diff)
downloadpsycopg2-8fb0f694f755a5c1bfdd67f923ec43be3c0d34b5.tar.gz
Don't barf on Composite passed to execute_values()fix-794
Close #794
Diffstat (limited to 'lib')
-rw-r--r--lib/extras.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/extras.py b/lib/extras.py
index ade0869..0764edf 100644
--- a/lib/extras.py
+++ b/lib/extras.py
@@ -1254,6 +1254,10 @@ def execute_values(cur, sql, argslist, template=None, page_size=100):
[(1, 20, 3), (4, 50, 6), (7, 8, 9)])
'''
+ from psycopg2.sql import Composable
+ if isinstance(sql, Composable):
+ sql = sql.as_string(cur)
+
# we can't just use sql % vals because vals is bytes: if sql is bytes
# there will be some decoding error because of stupid codec used, and Py3
# doesn't implement % on bytes.