Skip to content

Commit

Permalink
Correctly handle case where unpartitioned table does not exist (#14648)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCoding authored Nov 14, 2023
1 parent 8c4bff2 commit 1f36e84
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions awx/api/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@


def unpartitioned_event_horizon(cls):
with connection.cursor() as cursor:
cursor.execute(f"SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE table_name = '_unpartitioned_{cls._meta.db_table}';")
if not cursor.fetchone():
return 0
with connection.cursor() as cursor:
try:
cursor.execute(f'SELECT MAX(id) FROM _unpartitioned_{cls._meta.db_table}')
Expand Down

0 comments on commit 1f36e84

Please sign in to comment.