Skip to content

Commit

Permalink
Add SQL cast to fix from-SQL conversion of timespan literals.
Browse files Browse the repository at this point in the history
  • Loading branch information
TallJimbo committed Sep 20, 2022
1 parent 24cc1cc commit d6df482
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/lsst/daf/butler/registry/databases/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,9 @@ def fromLiteral(cls, timespan: Optional[Timespan]) -> _RangeTimespanRepresentati
if timespan is None:
return cls(column=sqlalchemy.sql.null(), name=cls.NAME)
return cls(
column=sqlalchemy.sql.literal(timespan, type_=_RangeTimespanType),
column=sqlalchemy.sql.cast(
sqlalchemy.sql.literal(timespan, type_=_RangeTimespanType), type_=_RangeTimespanType
),
name=cls.NAME,
)

Expand Down

0 comments on commit d6df482

Please sign in to comment.