From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: sandeshyapuram@gmail.com
Subject: BUG #15645: \COPY command not printing output in batch mode
Date: Wed, 20 Feb 2019 13:46:51 +0000
Message-ID: <15645-b22cf5a1fbbd37c3@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 15645
Logged by: placebo
Email address: sandeshyapuram@gmail.com
PostgreSQL version: 11.2
Operating system: Linux/Mac
Description:
I am trying to truncate a table and copy data into the same table using
\copy. In this process, I need to print number of rows deleted and copied.
I am using this command:
echo -e "begin; delete from test; \\\copy test from test.csv CSV HEADER;
end;" | psql -hlocalhost -dpostgres -Upostgres
Expected output:
---------------------
BEGIN
DELETE 4
COPY 2
COMMIT
---------------------
Actual output:
---------------------
BEGIN
DELETE 4
COMMIT
---------------------
As you can see, the output clearly is missing the copy count.
Interestingly, this works if I try the following command:
echo -e "begin;\ndelete from test;\n\\\copy test from test.csv CSV
HEADER;\nend;" | psql -hlocalhost -dpostgres -Upostgres
Why do I need to add a new line character when I am already using the
separator?
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, sandeshyapuram@gmail.com
Subject: Re: BUG #15645: \COPY command not printing output in batch mode
In-Reply-To: <15645-b22cf5a1fbbd37c3@postgresql.org>
References: <15645-b22cf5a1fbbd37c3@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox