FirebirdSQL / python3-driver

Firebird driver for Python that uses new Firebird API
https://www.firebirdsql.org/en/devel-python-driver/
MIT License
27 stars 10 forks source link

Wrong default type of READ COMMITTED transaction #29

Closed ant-zuev closed 1 year ago

ant-zuev commented 1 year ago

When specifying the READ COMMITTED isolation type, the RECORD_VERSION modifier is used: https://github.com/FirebirdSQL/python3-driver/blob/b40e0d95814b239fb24a3bcb9e8f80da74d91ed1/src/firebird/driver/core.py#L365-L367 although NO_RECORD_VERSION should be used by default. In general we should not specify a modifier if user has only specified READ COMMITTED isolation, as the server will use NO_RECORD_VERSION for READ COMMITTED by default.

pcisar commented 1 year ago

Once again, I don't understand your problem. There is no such a thing a "vanilla" READ_COMMITTED isolation if Firebird. It's either RC + RECORD VERSION or RC + NO record version. Having Isolation.READ_COMMITTED defined in firebird-driver is and artifact for developers porting from old FDB driver that used predefined TPB buffers and where ISOLATION_LEVEL_READ_COMMITED was defined - as read committed RECORD VERSION, see:

https://github.com/FirebirdSQL/fdb/blob/master/fdb/fbcore.py#L367-L371

firebird-driver uses enum Isolation and different method to specify transaction parameters, so Isolation.READ_COMMITTED = -1 value was defined (note the value -1), so porting developers can use the familiar name to achieve the same result as with FDB.

New firebird-driver users should rather use the other Isolation values to be more clear about the transaction isolation level.