I would like to use GET DIAGNOSTICS integer_var = ROW_COUNT
in plpgsql code to get the number of rows inserted into a table by a INSERT INTO
statement.
If I run multiple INSERT INTO
statements almost simultaneously can I be sure that GET DIAGNOSTICS
returns the number of inserted rows correctly for each statement?
I can illustrate this with an example, if this happens in the following sequence:
- User A runs a insert into statement that inserts 10 rows into a table.
- user B runs a insert into statement that inserts 5 rows into a table.
- User A calls
GET DIAGNOSTICS rowcount = ROW_COUNT;
- User B calls
GET DIAGNOSTICS rowcount = ROW_COUNT;
Will user A get a rowcount
of 10 and user B of 5? Or will both get 5?