Skip to content

Releases: vapor/postgres-nio

Fix prepare(query:) when no data returned

20 Aug 19:16
dddb196

Choose a tag to compare

This patch was authored by @Jerry-Carter and released by @tanner0101.

Fixes prepare(query:) when used with queries that return no results (like DELETE ...) (#123, fixes #122).

Integer overflow fixes

30 Jul 15:36
70d63c5

Choose a tag to compare

This patch was authored and released by @tanner0101.

Deprecates PostgresData integer conversion methods that could lead to overflow errors (#120, fixes #119).

Using the following types in release-mode should no longer be susceptible to overflow (or underflow) crashes:

  • UInt
  • Int8
  • UInt16
  • UInt32
  • UInt64

⚠️ However, these types will still be interpreted incorrectly by Postgres since it doesn't have native support for them. This could create problems with other clients connecting to the database. To prevent such issues, using these types will now result in a debug-mode only assertion.

To migrate away from these types, there are two options:

1: Use a wider integer (or type) that does not overflow or underflow.

For example:

  • Int8 -> Int16
  • UInt16 -> Int32
  • UInt32 -> Int (Int64)
  • UInt / UInt64 -> String

The caveats with this method are increased storage size and a database migration is required.

2: Do an explicit bitPattern conversion to the inversely signed type with same bit width.

For example, using Fluent:

// Store the value as `Int32` in Postgres
@Field(key: "foo")
var _foo: Int32

// Access the value as if it were a `UInt32`. 
var foo: UInt32 {
    get {
        .init(bitPattern: self._foo)
    }
    set {
        self._foo = .init(bitPattern: newValue)
    }
}

The caveat with this method is that other clients may misinterpret the stored value.

Fix warnings + update CI

29 Jul 00:54
aa5c2df

Choose a tag to compare

This patch was authored and released by @tanner0101.

Fix Xcode 12 beta 3 warnings and add additional test cases to CI (#117).

Support parameter status messages in query / simpleQuery

16 Jul 17:01
ffa8b35

Choose a tag to compare

This patch was authored and released by @tanner0101.

Adds support for parameter status (S) messages in query and simpleQuery calls (#116, fixes #115).

Add support for VARCHAR[]

14 Jul 18:11
711b726

Choose a tag to compare

This patch was authored and released by @tanner0101.

Adds support for CHARACTER VARYING[] a.k.a VARCHAR[] (#114, fixes #113).

Support remote close

11 Jul 18:08
944706b

Choose a tag to compare

This patch was authored and released by @tanner0101.

Adds support for recognizing a remote close as calling close() (fixes #107, #110)

RawRepresentable + PostgresData

24 Apr 20:47

Choose a tag to compare

This patch was authored and released by @tanner0101.

Add default PostgresDataConvertible conformance to RawRepresentable where the raw value is postgres convertible (#105, vapor/postgres-kit#179).

Too many binds error

24 Apr 17:53
93e9843

Choose a tag to compare

This patch was authored and released by @tanner0101.

Throw an error if too many binds (>= Int16.max) are sent in a parameterized query (#103, fixes #102).

PostgresNIO 1.0.0

22 Apr 14:05
81a309a

Choose a tag to compare

Add query metadata

03 Apr 17:07
a528171

Choose a tag to compare

Add query metadata Pre-release
Pre-release
This patch was authored and released by @tanner0101.

Adds new API for accessing query metadata via conn.query (fixes #93).

conn.query("...", onMetadata: { metadata in 
    print(metadata.rows) // Int?
}) { row in 
    print(row) // PostgresRow
}.wait()

This is a breaking change since conn.query now returns PostgresQueryResult instead of [PostgresRow]. However, PostgresQueryResult conforms to Collection so most code should be unaffected.

let result = try conn.query("...").wait()
for row in result {
    print(row) // PostgresRow
}
print(result.metadata) // PostgresQueryMetadata
print(result.rows) // [PostgresRow]