Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Commit db4da0f

Browse files
committed
Fixed condition in postgres backend Record __getitem__()
1 parent 5fdf35a commit db4da0f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

databases/backends/postgres.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,11 @@ def __init__(
8484
def __getitem__(self, key: typing.Any) -> typing.Any:
8585
if len(self._column_map) == 0: # raw query
8686
return self._row[tuple(self._row.keys()).index(key)]
87-
if len(self._column_map) > 0:
88-
if type(key) is Column:
89-
idx, datatype = self._column_map_full[str(key)]
90-
else:
91-
idx, datatype = self._column_map[key]
92-
raw = self._row[idx]
87+
elif type(key) is Column:
88+
idx, datatype = self._column_map_full[str(key)]
89+
else:
90+
idx, datatype = self._column_map[key]
91+
raw = self._row[idx]
9392
try:
9493
processor = _result_processors[datatype]
9594
except KeyError:

0 commit comments

Comments
 (0)