Skip to content

Commit 70ce734

Browse files
authored
Declare supported UNION features (#215)
* Minor test cleanup; stop overriding log levels and don't crash in the performance test if the database credentials are wrong * Declare (and require) support for the new union feature flags.
1 parent ce87ab2 commit 70ce734

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let package = Package(
1111
],
1212
dependencies: [
1313
.package(url: "https://github.com/vapor/postgres-nio.git", from: "1.4.0"),
14-
.package(url: "https://github.com/vapor/sql-kit.git", from: "3.12.0"),
14+
.package(url: "https://github.com/vapor/sql-kit.git", from: "3.16.0"),
1515
.package(url: "https://github.com/vapor/async-kit.git", from: "1.0.0"),
1616
],
1717
targets: [

Sources/PostgresKit/PostgresDialect.swift

+4
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,8 @@ public struct PostgresDialect: SQLDialect {
5555
public var upsertSyntax: SQLUpsertSyntax {
5656
.standard
5757
}
58+
59+
public var unionFeatures: SQLUnionFeatures {
60+
[.union, .unionAll, .intersect, .intersectAll, .except, .exceptAll, .explicitDistinct, .parenthesizedSubqueries]
61+
}
5862
}

Tests/PostgresKitTests/PostgresKitTests.swift

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ class PostgresKitTests: XCTestCase {
77
func testSQLKitBenchmark() throws {
88
let conn = try PostgresConnection.test(on: self.eventLoop).wait()
99
defer { try! conn.close().wait() }
10-
conn.logger.logLevel = .trace
1110
let benchmark = SQLBenchmarker(on: conn.sql())
1211
try benchmark.run()
1312
}
@@ -24,7 +23,7 @@ class PostgresKitTests: XCTestCase {
2423
// which causes XCTest to bail due to the first measurement having a very high deviation.
2524
// Spin the pool a bit before running the measurement to warm it up.
2625
for _ in 1...25 {
27-
_ = try! pool.withConnection { conn in
26+
_ = try pool.withConnection { conn in
2827
return conn.query("SELECT 1;")
2928
}.wait()
3029
}
@@ -91,7 +90,6 @@ class PostgresKitTests: XCTestCase {
9190
func testArrayEncoding() throws {
9291
let conn = try PostgresConnection.test(on: self.eventLoop).wait()
9392
defer { try! conn.close().wait() }
94-
conn.logger.logLevel = .trace
9593

9694
struct Foo: Codable {
9795
var bar: Int
@@ -104,7 +102,6 @@ class PostgresKitTests: XCTestCase {
104102
func testDictionaryEncoding() throws {
105103
let conn = try PostgresConnection.test(on: self.eventLoop).wait()
106104
defer { try! conn.close().wait() }
107-
conn.logger.logLevel = .trace
108105

109106
struct Foo: Codable {
110107
var bar: Int

0 commit comments

Comments
 (0)