Skip to content

Commit 114e6aa

Browse files
SKaltSteven Kalt
authored andcommitted
Fix: an existing index == None should return False
While using `migra`, I got the following error: `AttributeError: 'NoneType' object has no attribute 'name'`. Using `pdb`, I determined that the error arose when a table with an index was compared to one without an index. This patch eliminated the error.
1 parent fc8d925 commit 114e6aa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

schemainspect/pg/obj.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,12 @@ def create_statement(self):
436436

437437
def __eq__(self, other):
438438
"""
439-
:type other: InspectedIndex
439+
:type other: Optional[InspectedIndex]
440440
:rtype: bool
441441
"""
442+
if other is None: # sometimes the other index doesn't exist
443+
return False
444+
442445
equalities = (
443446
self.name == other.name,
444447
self.schema == other.schema,

0 commit comments

Comments
 (0)