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 1hYDau-00019R-Hu for pgsql-general@arkaria.postgresql.org; Tue, 04 Jun 2019 17:51:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hYDat-0007y0-EI for pgsql-general@arkaria.postgresql.org; Tue, 04 Jun 2019 17:51:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hYDat-0007xt-57 for pgsql-general@lists.postgresql.org; Tue, 04 Jun 2019 17:51:31 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hYDaq-0007u4-UV for pgsql-general@postgresql.org; Tue, 04 Jun 2019 17:51:30 +0000 Received: from [192.168.127.1] (port=12782 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1hYDap-0005VK-5p; Tue, 04 Jun 2019 17:51:27 +0000 Received: from [127.0.0.1] (port=43744 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1hYDao-00026X-Fp; Tue, 04 Jun 2019 17:51:26 +0000 From: Andrew Gierth To: Matthias Apitz Cc: Postgres general Subject: Re: Two small questions re/ COPY CSV data into table In-Reply-To: <20190604172054.GA4376@sh4-5.1blu.de> (Matthias Apitz's message of "Tue, 4 Jun 2019 19:20:54 +0200") Message-ID: <877ea18cli.fsf@news-spur.riddles.org.uk> 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> <20190604172054.GA4376@sh4-5.1blu.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Tue, 04 Jun 2019 18:51:26 +0100 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "Matthias" == Matthias Apitz writes: Matthias> it is exported into the file as Matthias> cmd \| lpr ... Matthias> because the export delimiter is set to '|'; Matthias> the COPY in text mode was complaining because it interpreted Matthias> the | of the sequence \| as an delimiter and the number of Matthias> columns did not matched. Matthias> I will provide tomorrow the exact input line, the exact COPY Matthias> command and the error. This worked for me: postgres=# copy ct(a,b,c,d,e) from stdin with delimiter '|'; Enter data to be copied followed by a newline. End with a backslash and a period on a line by itself, or an EOF signal. >> 0|1| cat $1 \| lpr -Pprinter |3|4 >> \. COPY 1 -- Andrew (irc:RhodiumToad)