When copying data from a file, you get the count of rows in psql with the "command tag":
db=# COPY t FROM '/var/lib/postgres/test.sql';
COPY 10
I need the number of rows and would like to avoid a redundant count()
on the table.
Is there a way to get this count from COPY
directly in a PL/pgSQL function?
As far as I know there is none, but maybe I am missing something?
For PostgreSQL 9.2. But any option in any version would be of interest.