This PR implement skipping postgres packets from database after encoding error, almost in the same way as the previous PR does for mysql. It also adds a bunch of tests for different cases:
Simple queries
Extended queries (and prepared statements, that are basically the same under the hood).
Batched extended queries (when database sends n packets and waits for the next request)
The only issue with postgres is that a state of transaction is stored at database side, and changes in case of some errors (even parsing ones). When the state is changed, commit is basically rollback:
test=# begin;
BEGIN
test=*# select 1/0;
ERROR: division by zero
test=!# commit;
ROLLBACK
But our error will not trigger that:
test=# begin;
BEGIN
test=*# select value_bytes from testtype;
ERROR: encoding error in column "value_bytes"
test=# commit;
COMMIT
So, for now I will mention it in the docs. Currently there is no straight and simple solution.
P.S. test.py crossed the milestone of 10 thousands lines, so my congratulations! It takes 5 second for my formatter to proceed the file. That's what I call success.
This PR implement skipping postgres packets from database after encoding error, almost in the same way as the previous PR does for mysql. It also adds a bunch of tests for different cases:
n
packets and waits for the next request)The only issue with postgres is that a state of transaction is stored at database side, and changes in case of some errors (even parsing ones). When the state is changed,
commit
is basicallyrollback
:But our error will not trigger that:
So, for now I will mention it in the docs. Currently there is no straight and simple solution.
P.S.
test.py
crossed the milestone of 10 thousands lines, so my congratulations! It takes 5 second for my formatter to proceed the file. That's what I call success.Checklist