From 14168297bdeb9376cda2fd1a7729d917cb29fe0c Mon Sep 17 00:00:00 2001 From: Jim Ladd Date: Thu, 25 Mar 2021 14:23:53 -0700 Subject: [PATCH] set event horizon to -1 for empty tables --- awx/api/views/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/api/views/__init__.py b/awx/api/views/__init__.py index 8a61c10ef6..2dfb35c462 100644 --- a/awx/api/views/__init__.py +++ b/awx/api/views/__init__.py @@ -181,7 +181,7 @@ def unpartitioned_event_horizon(cls): with connection.cursor() as cursor: try: cursor.execute(f'SELECT MAX(id) FROM _unpartitioned_{cls._meta.db_table}') - return cursor.fetchone()[0] + return cursor.fetchone()[0] or -1 except ProgrammingError: return 0