[dataimport] Fallback from COPY to executemany (closes #9135780)
If we can't build a suitable COPY command (e.g. because data has
unsupported type), use executemany instead. Regression introduced in
3.20.0.
--- a/dataimport.py Mon Dec 14 12:11:44 2015 +0100
+++ b/dataimport.py Mon Dec 14 16:19:52 2015 +0100
@@ -380,8 +380,9 @@
columns, encoding='utf-8'):
""" Execute thread with copy from
"""
- buf = _create_copyfrom_buffer(data, columns, encoding=encoding)
- if buf is None:
+ try:
+ buf = _create_copyfrom_buffer(data, columns, encoding=encoding)
+ except ValueError:
_execmany_thread_not_copy_from(cu, statement, data)
else:
if columns is None: