Retrieve number of rows from COPY command inside a plpgsql function - Mailing list pgsql-general

From Erwin Brandstetter
Subject Retrieve number of rows from COPY command inside a plpgsql function
Date
Msg-id 8753f741-0462-487d-b5e3-9ded4aabe845@y4g2000vbx.googlegroups.com
Whole thread Raw
List pgsql-general
Aloha!

I am trying to retrieve the number of rows copied by a COPY command
inside a plpgsql function.

The docs tell me, that the "command tag" holds this information. But
how to access the command tag from within a plpgsql function?
http://www.postgresql.org/docs/9.0/interactive/sql-copy.html

I am COPYing the huge result of a complex SQL query to a file and
would like to output the number of rows. I could write to a temp table
and use
GET DIAGNOSTICS integer_var = ROW_COUNT;
and COPY from there. But that takes twice as long. GET DIAGNOSTICS
does not currently work for COPY ..

Am I missing something?

TIA
Erwin Brandstetter

pgsql-general by date:

Previous
From: Dmitry Koterov
Date:
Subject: Re: Dump a database excluding one table DATA?
Next
From: Adrian Klaver
Date:
Subject: Re: Dump a database excluding one table DATA?