diff --git a/Sources/PostgresNIO/Data/PostgresData+Date.swift b/Sources/PostgresNIO/Data/PostgresData+Date.swift index 6d730f25..8a60806c 100644 --- a/Sources/PostgresNIO/Data/PostgresData+Date.swift +++ b/Sources/PostgresNIO/Data/PostgresData+Date.swift @@ -6,7 +6,7 @@ extension PostgresData { var buffer = ByteBufferAllocator().buffer(capacity: 0) let seconds = date.timeIntervalSince(_psqlDateStart) * Double(_microsecondsPerSecond) buffer.writeInteger(Int64(seconds)) - self.init(type: .timestamptz, value: buffer) + self.init(type: .timestamp, value: buffer) } public var date: Date? { @@ -39,7 +39,7 @@ extension PostgresData { @available(*, deprecated, message: "Deprecating conformance to `PostgresDataConvertible`, since it is deprecated.") extension Date: PostgresDataConvertible { public static var postgresDataType: PostgresDataType { - return .timestamptz + return .timestamp } public init?(postgresData: PostgresData) { diff --git a/Sources/PostgresNIO/New/Data/Date+PostgresCodable.swift b/Sources/PostgresNIO/New/Data/Date+PostgresCodable.swift index 31d8d749..ab632f58 100644 --- a/Sources/PostgresNIO/New/Data/Date+PostgresCodable.swift +++ b/Sources/PostgresNIO/New/Data/Date+PostgresCodable.swift @@ -3,7 +3,7 @@ import struct Foundation.Date extension Date: PostgresNonThrowingEncodable { public static var psqlType: PostgresDataType { - .timestamptz + .timestamp } public static var psqlFormat: PostgresFormat { diff --git a/Sources/PostgresNIO/New/PSQLError.swift b/Sources/PostgresNIO/New/PSQLError.swift index 4a9f9216..e9624125 100644 --- a/Sources/PostgresNIO/New/PSQLError.swift +++ b/Sources/PostgresNIO/New/PSQLError.swift @@ -470,17 +470,6 @@ public struct PSQLError: Error, @unchecked Sendable { } } -extension PSQLError: CustomStringConvertible { - public var description: String { - // This may seem very odd... But we are afraid that users might accidentally send the - // unfiltered errors out to end-users. This may leak security relevant information. For this - // reason we overwrite the error description by default to this generic "Database error" - """ - PSQLError – Generic description to prevent accidental leakage of sensitive data. For debugging details, use `String(reflecting: error)`. - """ - } -} - extension PSQLError: CustomDebugStringConvertible { public var debugDescription: String { var result = #"PSQLError(code: \#(self.code)"# @@ -617,17 +606,6 @@ public struct PostgresDecodingError: Error, Equatable { } } -extension PostgresDecodingError: CustomStringConvertible { - public var description: String { - // This may seem very odd... But we are afraid that users might accidentally send the - // unfiltered errors out to end-users. This may leak security relevant information. For this - // reason we overwrite the error description by default to this generic "Database error" - """ - PostgresDecodingError – Generic description to prevent accidental leakage of sensitive data. For debugging details, use `String(reflecting: error)`. - """ - } -} - extension PostgresDecodingError: CustomDebugStringConvertible { public var debugDescription: String { var result = #"PostgresDecodingError(code: \#(self.code)"# diff --git a/Tests/IntegrationTests/PerformanceTests.swift b/Tests/IntegrationTests/PerformanceTests.swift index 6f730560..aa483e47 100644 --- a/Tests/IntegrationTests/PerformanceTests.swift +++ b/Tests/IntegrationTests/PerformanceTests.swift @@ -87,7 +87,7 @@ final class PerformanceTests: XCTestCase { """ "string" text, "int" int8, - "date" timestamptz, + "date" timestamp, "uuid" uuid, """, fixtureData: [ @@ -138,11 +138,11 @@ final class PerformanceTests: XCTestCase { "int3" int8, "int4" int8, "int5" int8, - "date1" timestamptz, - "date2" timestamptz, - "date3" timestamptz, - "date4" timestamptz, - "date5" timestamptz, + "date1" timestamp, + "date2" timestamp, + "date3" timestamp, + "date4" timestamp, + "date5" timestamp, "uuid1" uuid, "uuid2" uuid, "uuid3" uuid, diff --git a/Tests/IntegrationTests/PostgresNIOTests.swift b/Tests/IntegrationTests/PostgresNIOTests.swift index ff59209b..0b074429 100644 --- a/Tests/IntegrationTests/PostgresNIOTests.swift +++ b/Tests/IntegrationTests/PostgresNIOTests.swift @@ -1103,7 +1103,7 @@ final class PostgresNIOTests: XCTestCase { "table2_id" int8, "intValue" int8, "stringValue" text, - "dateValue" timestamptz, + "dateValue" timestamp, PRIMARY KEY ("id") ); """).wait()) @@ -1115,7 +1115,7 @@ final class PostgresNIOTests: XCTestCase { "id" int8 NOT NULL, "intValue" int8, "stringValue" text, - "dateValue" timestamptz, + "dateValue" timestamp, PRIMARY KEY ("id") ); """).wait()) diff --git a/Tests/PostgresNIOTests/New/Data/Date+PSQLCodableTests.swift b/Tests/PostgresNIOTests/New/Data/Date+PSQLCodableTests.swift index 3f406598..a35bc8f5 100644 --- a/Tests/PostgresNIOTests/New/Data/Date+PSQLCodableTests.swift +++ b/Tests/PostgresNIOTests/New/Data/Date+PSQLCodableTests.swift @@ -9,7 +9,7 @@ class Date_PSQLCodableTests: XCTestCase { var buffer = ByteBuffer() value.encode(into: &buffer, context: .default) - XCTAssertEqual(Date.psqlType, .timestamptz) + XCTAssertEqual(Date.psqlType, .timestamp) XCTAssertEqual(buffer.readableBytes, 8) var result: Date? diff --git a/Tests/PostgresNIOTests/New/PostgresErrorTests.swift b/Tests/PostgresNIOTests/New/PostgresErrorTests.swift index 33df5439..32cf4603 100644 --- a/Tests/PostgresNIOTests/New/PostgresErrorTests.swift +++ b/Tests/PostgresNIOTests/New/PostgresErrorTests.swift @@ -41,10 +41,7 @@ final class PSQLErrorTests: XCTestCase { var testBinds = PostgresBindings(capacity: 1) testBinds.append(1, context: .default) error1.query = .init(unsafeSQL: "TEST QUERY", binds: testBinds) - - XCTAssertEqual(String(describing: error1), """ - PSQLError – Generic description to prevent accidental leakage of sensitive data. For debugging details, use `String(reflecting: error)`. - """) + XCTAssertEqual(String(reflecting: error1), """ PSQLError(code: server, serverInfo: [sqlState: 00000, detail: More test message, file: PostgresNIOTests/PostgresErrorTests.swift, hint: It's a test, that's your hint, line: 0, message: Test message, position: 1, routine: testPSQLErrorDescription(), localizedSeverity: ERROR, severity: ERROR, columnName: testcol, dataTypeName: testtyp, constraintName: testcon, schemaName: testsch, tableName: testtab], query: PostgresQuery(sql: TEST QUERY, binds: [(****; BIGINT; format: binary)])) """) @@ -107,14 +104,6 @@ final class PostgresDecodingErrorTests: XCTestCase { line: 123 ) - // Plain description - XCTAssertEqual(String(describing: error1), """ - PostgresDecodingError – Generic description to prevent accidental leakage of sensitive data. For debugging details, use `String(reflecting: error)`. - """) - XCTAssertEqual(String(describing: error2), """ - PostgresDecodingError – Generic description to prevent accidental leakage of sensitive data. For debugging details, use `String(reflecting: error)`. - """) - // Extended debugDescription XCTAssertEqual(String(reflecting: error1), """ PostgresDecodingError(code: typeMismatch,\