Releases: vapor/postgres-nio
PostgresNIO 1.6.1
SemVer Patch
- Fix NIOSSL deprecation warnings (#168) (patch credit to @jareyesda)
- Fix NIO imports (#171)
Other Changes
1.6.0
- Add platform requirements for iOS, watchOS and tvOS (#154)
- Update api-docs.yml (#156) Thanks @JaapWijnen
- Split out
IntegrationTests
into separatetestTarget
(#157) - Use sync pipeline operations, update NIO dependencies (#152)
- Add one Auth and one SSL test case (#159)
- Fix API docs link. Resolves (#163)
- Add link to our SECURITY.md (#164)
- Use
PSQLFormat
when encoding and decoding (#158) - Support AWS Redshift queries - SELECT Metadata without row number (#167) Thanks @grennis
Ignore errors when closing the connection
This patch was authored by @fabianfett and released by @0xTim.
Resolves an issue where errors thrown by some database servers during closing a connection would cause an error in PostgresNIO. Resolves #150
Modifications
- We ignore errors when the connection is already closing
- Updated logging to only issue debug and trace logs.
- Don't print password in trace logging mode.
Fixes an issue where empty values were treated as null values and vica versa
This patch was authored by @fabianfett and released by @0xTim.
Fix encoding and decoding optional values to and from the database due to a regression in #135. Resolves #143 (#144)
Fixes an issue where empty values were treated as null values and vica versa
This patch was authored by @fabianfett and released by @0xTim.
Fix encoding and decoding optional values to and from the database due to a regression in #135. Resolves #143 (#144)
State machine
This patch was authored by @fabianfett and released by @0xTim.
Motivation
Connection state changes can be modeled with state machines. This PR introduces a ConnectionStateMachine
that models the PostgresConnection
's state. This will improve the Unit-testability of this package.
Changes
- This PR does not change any public API
- It replaces the underlying implementation of
PostgresConnection
with a newPSQLConnection
- All new classes and structs that support the new
PSQLConnection
live in the/New
folder - The
PSQLConnection
is mainly implemented using thesestructs
andclasses
:PSQLFrontendMessage
a new enum modeling outgoing client messages to the serverPSQLBackendMessage
a new enum modeling incoming server messages to the clientPSQLFrontendMessage.Encoder
a newMessageToByteEncoder
PSQLBackendMessage.Decoder
a newByteToMessageEncoder
ConnectionStateMachine
with the sub state machines:AuthenticationStateMachine
CloseStateMachine
ExtendedQueryStateMachine
PrepareStatementStateMachine
PSQLChannelHandler
is the mainChannelDuplexHandler
for thePSQLConnection
PSQLEventsHandler
is a newChannelHandler
that observes the channel events and closes the connection when appropriate.PSQLEncodable
is a new protocol to convert Swift types to Postgres types.PSQLDecodable
is a new protocol to convert Postgres types to Swift types.PSQLEncodable
andPSQLDecodable
defer the encoding and decoding as much as possible, saving unnecessary allocations and conversions.
- Thanks to these changes extended queries and prepared statements will now take the same code paths. Thus we ensure that code improvements for one query type will also lead to improvements for the other.
Result
We get a better testable PostgresConnection
.
State machine
This patch was authored by @fabianfett and released by @0xTim.
Motivation
Connection state changes can be modeled with state machines. This PR introduces a ConnectionStateMachine
that models the PostgresConnection
's state. This will improve the Unit-testability of this package.
Changes
- This PR does not change any public API
- It replaces the underlying implementation of
PostgresConnection
with a newPSQLConnection
- All new classes and structs that support the new
PSQLConnection
live in the/New
folder - The
PSQLConnection
is mainly implemented using thesestructs
andclasses
:PSQLFrontendMessage
a new enum modeling outgoing client messages to the serverPSQLBackendMessage
a new enum modeling incoming server messages to the clientPSQLFrontendMessage.Encoder
a newMessageToByteEncoder
PSQLBackendMessage.Decoder
a newByteToMessageEncoder
ConnectionStateMachine
with the sub state machines:AuthenticationStateMachine
CloseStateMachine
ExtendedQueryStateMachine
PrepareStatementStateMachine
PSQLChannelHandler
is the mainChannelDuplexHandler
for thePSQLConnection
PSQLEventsHandler
is a newChannelHandler
that observes the channel events and closes the connection when appropriate.PSQLEncodable
is a new protocol to convert Swift types to Postgres types.PSQLDecodable
is a new protocol to convert Postgres types to Swift types.PSQLEncodable
andPSQLDecodable
defer the encoding and decoding as much as possible, saving unnecessary allocations and conversions.
- Thanks to these changes extended queries and prepared statements will now take the same code paths. Thus we ensure that code improvements for one query type will also lead to improvements for the other.
Result
We get a better testable PostgresConnection
.
Make PostgresNIO tests non throwing
This patch was authored by @fabianfett and released by @0xTim.
Refactor all remaining PostgresNIO tests to get better error diagnostics in case of unexpected errors. (#141)
Follow up to #140.
Remove unintended SASL print statement
This patch was authored by @fabianfett and released by @gwynne.
We currently print the internal SASL state when authenticating via SCRAM-SHA256
. This messes up logs and is a potential security issue.
Modifications
- Remove a print
statement
Support for SCRAM-SHA-256 SASL authentication
This patch was authored and released by @gwynne.
- PostgreSQL supports
SCRAM-SHA-256
authentication since version 11. This is preliminary support for that authentication type.