COPY table FROM STDIN doesn't show count tag

From: Tim Kane <tim(dot)kane(at)gmail(dot)com>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: COPY table FROM STDIN doesn't show count tag
Date: 2013-10-17 13:30:47
Message-ID: CE85A517.4878E%tim.kane@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


According to the docs, the output of a copy command should return a COPY
count. It turns out this only happens when copying from a file, and not
from STDIN.

> Outputs
> On successful completion, a COPY command returns a command tag of the form
> COPY count
> The count is the number of rows copied.
>
clone_test_rename=# create temp table aaa (field varchar(255));
CREATE TABLE
Time: 3.806 ms
clone_test_rename=# copy aaa from '/tmp/test.dat';
COPY 3
Time: 0.623 ms
clone_test_rename=# copy aaa from stdin;
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
>> 123
>> 456
>> hello
>> \.
Time: 8472.305 ms

Tested on 9.3.0
Is there another way I can determine the number of rows copied, short of
performing a pre and post count? (other than not using stdin, that is).

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2013-10-17 13:33:22 Re: Index creation fails with automatic names
Previous Message Christian Affolter 2013-10-17 13:22:51 Re: Remove or alter the default access privileges of the public schema by the database owner