Skip to content

Commit

Permalink
Declare supported UNION features (#215)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
gwynne authored Dec 14, 2021
1 parent ce87ab2 commit 70ce734
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/vapor/postgres-nio.git", from: "1.4.0"),
.package(url: "https://github.com/vapor/sql-kit.git", from: "3.12.0"),
.package(url: "https://github.com/vapor/sql-kit.git", from: "3.16.0"),
.package(url: "https://github.com/vapor/async-kit.git", from: "1.0.0"),
],
targets: [
Expand Down
4 changes: 4 additions & 0 deletions Sources/PostgresKit/PostgresDialect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,8 @@ public struct PostgresDialect: SQLDialect {
public var upsertSyntax: SQLUpsertSyntax {
.standard
}

public var unionFeatures: SQLUnionFeatures {
[.union, .unionAll, .intersect, .intersectAll, .except, .exceptAll, .explicitDistinct, .parenthesizedSubqueries]
}
}
5 changes: 1 addition & 4 deletions Tests/PostgresKitTests/PostgresKitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class PostgresKitTests: XCTestCase {
func testSQLKitBenchmark() throws {
let conn = try PostgresConnection.test(on: self.eventLoop).wait()
defer { try! conn.close().wait() }
conn.logger.logLevel = .trace
let benchmark = SQLBenchmarker(on: conn.sql())
try benchmark.run()
}
Expand All @@ -24,7 +23,7 @@ class PostgresKitTests: XCTestCase {
// which causes XCTest to bail due to the first measurement having a very high deviation.
// Spin the pool a bit before running the measurement to warm it up.
for _ in 1...25 {
_ = try! pool.withConnection { conn in
_ = try pool.withConnection { conn in
return conn.query("SELECT 1;")
}.wait()
}
Expand Down Expand Up @@ -91,7 +90,6 @@ class PostgresKitTests: XCTestCase {
func testArrayEncoding() throws {
let conn = try PostgresConnection.test(on: self.eventLoop).wait()
defer { try! conn.close().wait() }
conn.logger.logLevel = .trace

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

struct Foo: Codable {
var bar: Int
Expand Down

0 comments on commit 70ce734

Please sign in to comment.