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 1hYD7P-0006dA-S2 for pgsql-general@arkaria.postgresql.org; Tue, 04 Jun 2019 17:21:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hYD7O-00083Y-LS for pgsql-general@arkaria.postgresql.org; Tue, 04 Jun 2019 17:21:02 +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 1hYD7O-00082T-8g for pgsql-general@lists.postgresql.org; Tue, 04 Jun 2019 17:21:02 +0000 Received: from smh-06.1blu.de ([178.254.0.206]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hYD7L-0005Ze-Ca for pgsql-general@postgresql.org; Tue, 04 Jun 2019 17:21:01 +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 1hYD7G-0004K6-Ku; Tue, 04 Jun 2019 19:20:54 +0200 Received: from ftp51246-2575596 by sh4-5.1blu.de with local (Exim 4.86_2) (envelope-from ) id 1hYD7G-000238-Ie; Tue, 04 Jun 2019 19:20:54 +0200 Date: Tue, 4 Jun 2019 19:20:54 +0200 From: Matthias Apitz To: Andrew Gierth Cc: Postgres general Subject: Re: Two small questions re/ COPY CSV data into table Message-ID: <20190604172054.GA4376@sh4-5.1blu.de> Reply-To: Matthias Apitz References: <20190604100247.GA2800@c720-r342378> <877ea1aby6.fsf@news-spur.riddles.org.uk> <20190604150318.GA13915@sh4-5.1blu.de> <87sgsp8ikd.fsf@news-spur.riddles.org.uk> <20190604162650.GA15928@sh4-5.1blu.de> <87blzd8fdq.fsf@news-spur.riddles.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87blzd8fdq.fsf@news-spur.riddles.org.uk> 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.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk El día Tuesday, June 04, 2019 a las 05:56:49PM +0100, Andrew Gierth escribió: > Matthias> The new DELIMITER for PG is then vtab and the | is just a char in the > Matthias> data (in the example above a pipe of two UNIX cmd). > > Yes, but why? > > If you use COPY ... WITH DELIMITER '|' (i.e. text mode, not CSV mode) > then the \| is accepted as being a literal | and the unescaped | is > treated as a delimiter. What is the point of the substitutions? In the original data record in Sybase there is a column containing, i.e. some UNIX print command to be read and executed by the application: cmd | lpr ... it is exported into the file as cmd \| lpr ... because the export delimiter is set to '|'; the COPY in text mode was complaining because it interpreted the | of the sequence \| as an delimiter and the number of columns did not matched. I will provide tomorrow the exact input line, the exact COPY command and the error. 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!