From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | sandeshyapuram(at)gmail(dot)com |
Subject: | BUG #15645: \COPY command not printing output in batch mode |
Date: | 2019-02-20 13:46:51 |
Message-ID: | 15645-b22cf5a1fbbd37c3@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 15645
Logged by: placebo
Email address: sandeshyapuram(at)gmail(dot)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?
From | Date | Subject | |
---|---|---|---|
Next Message | Jeremy Finzel | 2019-02-20 14:24:59 | Re: Segmentation Fault in logical decoding get/peek API |
Previous Message | PG Bug reporting form | 2019-02-20 12:14:52 | BUG #15644: not able to up the database |