My use case is that I need to execute GRANT
and TRUNCATE
statements on a table concurrently.
Sample scenario:
When I try to execute below statements in parallel(two separate terminals):
while true; do psql -U <user> -d <database> -c 'GRANT select ON test1 TO <user>;'; done
while true; do psql -U <user> -d <database> -c 'TRUNCATE test1;'; done
I get the following error:
ERROR: tuple concurrently updated
I don't understand the reason for the error. The TRUNCATE
statement doesn't have anything to do with privileges. Then why can't I execute these statements concurrently?