---
🚀 New Features and Enhancements:
**Improved Connection Management:**
- Enhanced support for **asynchronous transactions** and **connection pooling**.
- Added `transaction` methods for both `PGAsyncConnection` and `PGPoolConnection` classes, allowing easier management of transactions with `async with` and `with` statements.
- This improvement standardizes transaction handling across different connection types, making it simpler to work with pooled and async connections.
**Context Management for Cursors:**
- Now supports the use of `async with connection.cursor()` for `PGAsyncConnection` and `PGAsyncPoolConnection`.
- Synchronous cursor handling for `PGPoolConnection` and `PGNormalConnection` has been streamlined, ensuring consistent behavior across different connection types.
- This enhancement allows for better resource management and automatically closes cursors when they are no longer needed.
**Detailed Connection Testing:**
- Updated connection tests to include more comprehensive validation of connection pooling behavior.
- For example, `test_connection()` now verifies the acquisition of multiple connections in `PGAsyncPoolConnection` and `PGPoolConnection` to ensure pools are correctly managing connection limits.
- This improvement provides more robust testing to identify potential issues with pool configurations before they impact production.
---
♻️ Backward Compatibility:
- All previous connection methods remain available. The new transaction handling and cursor management features are **additive**, providing more options without breaking existing workflows.
- Legacy connection configuration options like `pool_settings` and `async_settings` are still supported, though users are encouraged to leverage the new streamlined transaction methods for improved efficiency.
---
🐛 Bug Fixes:
- **Resolved**: Fixed issues with connection pooling where connections were not being correctly returned to the pool under certain conditions.
- **Improved**: Error handling during connection setup and teardown has been refined, ensuring more informative error messages when connection or transaction issues occur.
- **Corrected**: Addressed an issue where the `PGAsyncConnection` class raised an error when using `command_timeout`, making settings validation more accurate.
---
⚙️ Migration Notes:
- Users are encouraged to update their testing scripts to use the new `transaction()` methods for managing database transactions in both async and sync environments. This makes it easier to leverage automatic commit/rollback behaviors.
- No major configuration changes are required. Existing YAML configuration files will continue to work as before, but users can now take advantage of more robust transaction handling.
This release focuses on enhancing developer productivity and reliability with better transaction handling, more intuitive cursor management, and thorough testing capabilities. Happy coding with pgmonkey! 🐒🚀