If an active transaction performs a long fetch (e.g. "fetch-all" of more than 1M rows) from a trivial data source (table or simple stored procedure) the query cancellation does not affect that activity, thus allowing all records to be successfully fetched.
Sample of the query not affected by the cancellation:
RETURNS (cnt INT)
cnt = 0;
WHILE (cnt < 5000000) DO
cnt = cnt + 1;