From: Daniele Varrazzo Date: Fri, 12 Aug 2022 01:40:20 +0000 (+0200) Subject: docs: reword blurb about binary copy and make it a warning X-Git-Tag: 3.1~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e1130de151daa24ed27b36075ab5a6c02e13f2e;p=thirdparty%2Fpsycopg.git docs: reword blurb about binary copy and make it a warning --- diff --git a/docs/basic/copy.rst b/docs/basic/copy.rst index 61cd8c03b..2bb0ca080 100644 --- a/docs/basic/copy.rst +++ b/docs/basic/copy.rst @@ -151,11 +151,16 @@ types passed to the database must have a binary dumper registered; this is not necessary if the data is copied :ref:`block-by-block ` using `~Copy.write()`. -Note that PostgreSQL is particularly finicky when loading data in binary mode -and will apply *no cast rules*. This means that e.g. passing the value 100 to -an `integer` column will fail because Psycopg will pass it as a `smallint` -value. You can work around the problem using the `~Copy.set_types()` method of -the `!Copy` object and specify carefully the types to dump. +.. warning:: + + PostgreSQL is particularly finicky when loading data in binary mode and + will apply **no cast rules**. This means, for example, that passing the + value 100 to an `integer` column **will fail**, because Psycopg will pass + it as a `smallint` value, and the server will reject it because its size + doesn't match what expected. + + You can work around the problem using the `~Copy.set_types()` method of + the `!Copy` object and specifying carefully the types to load. .. seealso:: See :ref:`binary-data` for further info about binary querying.