Skip to content

Commit

Permalink
Override SQLDataType.blob to BYTEA for SQLKit users (#264)
Browse files Browse the repository at this point in the history
PostgreSQL doesn't like `BLOB` as a type, override it for SQLKit users.
  • Loading branch information
gwynne committed May 2, 2024
1 parent 9535dc5 commit ad8ae1e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/PostgresKit/PostgresDialect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public struct PostgresDialect: SQLDialect {
public func customDataType(for dataType: SQLDataType) -> (any SQLExpression)? {
if case let .custom(expr) = dataType, (expr as? SQLRaw)?.sql == "TIMESTAMP" {
return SQLRaw("TIMESTAMPTZ")
} else if case .blob = dataType {
return SQLRaw("BYTEA")
} else {
return nil
}
Expand Down

0 comments on commit ad8ae1e

Please sign in to comment.