From: Daniele Varrazzo Date: Fri, 13 Jan 2023 01:30:05 +0000 (+0000) Subject: fix(copy): fix dumping by oid in text mode X-Git-Tag: pool-3.2.0~70^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40bb6203fd0e425cba32f59db381a68af4f5fd79;p=thirdparty%2Fpsycopg.git fix(copy): fix dumping by oid in text mode It is less useful than in binary mode, but it was being pretty much ignored. --- diff --git a/psycopg/psycopg/copy.py b/psycopg/psycopg/copy.py index df2975f6e..ec022de0b 100644 --- a/psycopg/psycopg/copy.py +++ b/psycopg/psycopg/copy.py @@ -811,13 +811,9 @@ def _format_row_text( out += b"\n" return out - for item in row: - if item is not None: - dumper = tx.get_dumper(item, PY_TEXT) - b = dumper.dump(item) - out += _dump_re.sub(_dump_sub, b) - else: - out += rb"\N" + adapted = tx.dump_sequence(row, [PY_TEXT] * len(row)) + for b in adapted: + out += _dump_re.sub(_dump_sub, b) if b is not None else rb"\N" out += b"\t" out[-1:] = b"\n"