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.89) (envelope-from ) id 1hY6Hg-0003w2-Pn for pgsql-general@arkaria.postgresql.org; Tue, 04 Jun 2019 10:03:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hY6He-00057U-W0 for pgsql-general@arkaria.postgresql.org; Tue, 04 Jun 2019 10:03:10 +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 1hY6He-00050J-Gt for pgsql-general@lists.postgresql.org; Tue, 04 Jun 2019 10:03:10 +0000 Received: from ms-10.1blu.de ([178.254.4.101]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hY6HQ-0004Hd-LU for pgsql-general@postgresql.org; Tue, 04 Jun 2019 10:03:09 +0000 Received: from [80.187.102.150] (helo=localhost.unixarea.de) by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.86_2) (envelope-from ) id 1hY6HM-0000fN-5a; Tue, 04 Jun 2019 12:02:52 +0200 Received: from localhost.my.domain (localhost [127.0.0.1]) by localhost.unixarea.de (8.15.2/8.14.9) with ESMTPS id x54A2lEY002831 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 4 Jun 2019 12:02:47 +0200 (CEST) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by localhost.my.domain (8.15.2/8.14.9/Submit) id x54A2lr2002830; Tue, 4 Jun 2019 12:02:47 +0200 (CEST) (envelope-from guru@unixarea.de) X-Authentication-Warning: localhost.my.domain: guru set sender to guru@unixarea.de using -f Date: Tue, 4 Jun 2019 12:02:47 +0200 From: Matthias Apitz To: Postgres general Subject: Two small questions re/ COPY CSV data into table Message-ID: <20190604100247.GA2800@c720-r342378> 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 13.0-CURRENT r342378 (amd64) X-message-flag: Mails containing HTML will not be read! Please send only plain text. User-Agent: Mutt/1.11.1 (2018-12-01) X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 80.187.102.150 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, I'm using COPY to load CSV data into the table in PG 10.x and have to simple questions: 1. I do use as command: COPY adm_cat FROM '/home/sisis/PostgreSQL/PDcsv/adm_cat.load' WITH DELIMITER '|' CSV ; which works fine. When I read the PG docs the syntax should be ... WITH DELIMITER '|', FORMAT CSV ; But this gives an syntax error as: LINE 1: .../PostgreSQL/PDcsv/adm_cat.load' WITH DELIMITER '|', FORMAT C... and the ',' is marked as its place. Why? 2. The CSV export is done by some Sybase tool which escapes the delimiter as '\|', i.e. putting a backslash before the delimiter. I found no way that COPY understands this excaping. Any ideas? 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!