1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Return the number of rows processed when COPY is executed through SPI.

You can now get the number of rows processed by a COPY statement in a
PL/pgSQL function with "GET DIAGNOSTICS x = ROW_COUNT".

Pavel Stehule, reviewed by Amit Kapila, with some editing by me.
This commit is contained in:
Heikki Linnakangas
2012-10-03 14:32:01 +03:00
parent bc1229c832
commit 7ae1815961
2 changed files with 19 additions and 10 deletions

View File

@ -377,7 +377,10 @@ SPI_execute("INSERT INTO foo SELECT * FROM bar", false, 5);
global pointer <literal>SPITupleTable *SPI_tuptable</literal> to
access the result rows. Some utility commands (such as
<command>EXPLAIN</>) also return row sets, and <literal>SPI_tuptable</>
will contain the result in these cases too.
will contain the result in these cases too. Some utility commands
(<command>COPY</>, <command>CREATE TABLE AS</>) don't return a row set, so
<literal>SPI_tuptable</> is NULL, but they still return the number of
rows processed in <varname>SPI_processed</>.
</para>
<para>