Fix logbook state query with postgresql (#73924)

This commit is contained in:
J. Nick Koston 2022-06-23 16:35:10 -05:00 committed by GitHub
parent 3058a432a5
commit 28dd92d928
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -377,9 +377,9 @@ def _rows_match(row: Row | EventAsRow, other_row: Row | EventAsRow) -> bool:
"""Check of rows match by using the same method as Events __hash__."""
if (
row is other_row
or (state_id := row.state_id) is not None
or (state_id := row.state_id)
and state_id == other_row.state_id
or (event_id := row.event_id) is not None
or (event_id := row.event_id)
and event_id == other_row.event_id
):
return True

View File

@ -87,7 +87,7 @@ EVENT_COLUMNS_FOR_STATE_SELECT = [
]
EMPTY_STATE_COLUMNS = (
literal(value=None, type_=sqlalchemy.String).label("state_id"),
literal(value=0, type_=sqlalchemy.Integer).label("state_id"),
literal(value=None, type_=sqlalchemy.String).label("state"),
literal(value=None, type_=sqlalchemy.String).label("entity_id"),
literal(value=None, type_=sqlalchemy.String).label("icon"),