Skip to content

Commit ad8ae1e

Browse files
authored
Override SQLDataType.blob to BYTEA for SQLKit users (#264)
PostgreSQL doesn't like `BLOB` as a type, override it for SQLKit users.
1 parent 9535dc5 commit ad8ae1e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Sources/PostgresKit/PostgresDialect.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ public struct PostgresDialect: SQLDialect {
7272
public func customDataType(for dataType: SQLDataType) -> (any SQLExpression)? {
7373
if case let .custom(expr) = dataType, (expr as? SQLRaw)?.sql == "TIMESTAMP" {
7474
return SQLRaw("TIMESTAMPTZ")
75+
} else if case .blob = dataType {
76+
return SQLRaw("BYTEA")
7577
} else {
7678
return nil
7779
}

0 commit comments

Comments
 (0)