Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jHr2B-0003Oj-9x for pgsql-general@arkaria.postgresql.org; Fri, 27 Mar 2020 15:36:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jHr2A-0006Ti-5h for pgsql-general@arkaria.postgresql.org; Fri, 27 Mar 2020 15:36:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jHr29-0006Tb-Om for pgsql-general@lists.postgresql.org; Fri, 27 Mar 2020 15:36:33 +0000 Received: from smh-06.1blu.de ([178.254.0.206]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jHr26-00071s-RY for pgsql-general@lists.postgresql.org; Fri, 27 Mar 2020 15:36:32 +0000 Received: from [172.16.29.5] (helo=sh4-5.1blu.de) by smh-06.1blu.de with esmtp (Exim 4.86_2) (envelope-from ) id 1jHr1z-0006Ky-KJ; Fri, 27 Mar 2020 16:36:24 +0100 Received: from ftp51246-2575596 by sh4-5.1blu.de with local (Exim 4.90_1) (envelope-from ) id 1jHr1z-0007BY-HU; Fri, 27 Mar 2020 16:36:23 +0100 Date: Fri, 27 Mar 2020 16:36:23 +0100 From: Matthias Apitz To: pgsql-general@lists.postgresql.org Subject: \COPY to accept non UTF-8 chars in CHAR columns Message-ID: <20200327153623.GA32266@sh4-5.1blu.de> Reply-To: Matthias Apitz MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Operating-System: FreeBSD 12.0-CURRENT r314251 (amd64) X-message-flag: Mails containing HTML will not be read! Please send only plain text. User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, We're moving databases from Sybase/Oracle to PostgreSQL 11.4 by unloading them with our own tool into a CSV like format and loading the rows with \COPY. One can imagine that in old databases, in use for a longer time, you will find any sort of dust which should not be there, for example ISO-8859-1 chars while the CHAR column should be in UTF-8. Needless to say, this data should not be there, it is just a fact, in parts caused by foreign data loaded into the Sybase/Oracle database, sometimes our own Java- or Perl-written software, breaks a longer CHAR column into two sequential rows (with an INT column to note the order), but does the break in the middle of an UTF-8 multi-byte, clumsy. :-( In short, it there a way to let \COPY accept such broken ISO bytes, just complaining about, but not stopping the insert of the row? Thanks matthias -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub May, 9: Спаси́бо освободители! Thank you very much, Russian liberators!