Whole file

andialbrecht/sqlparse

The author described this change as Fix get_real_name for names with more than two dotted parts (#332). It counts as a record because the check below fails on the code as it stood at df8e28495 and passes on f66d12c24, with nothing else changed between the two runs.

Fix saved2026-07-25
Sharing licenceBSD-3-Clause · LICENSE
Change size+5 2

What the code was meant to do, written into the code itself as a save note

Fix get_real_name for names with more than two dotted parts (#332)

The change

1818
1919 def get_real_name(self):
2020 """Returns the real name (object name) of this identifier."""
21- # a.b
22- dot_idx, _ = self.token_next_by(m=(T.Punctuation, '.'))
21+ # a.b.c -> real name is the component after the *last* dot
22+ dot_idx = None
23+ for idx, tok in enumerate(self.tokens):
24+ if tok.match(T.Punctuation, '.'):
25+ dot_idx = idx
2326 return self._get_first_name(dot_idx, real_name=True)
2427
2528 def get_alias(self):

The check that tells the two apart

failpass·tests/test_parse.py::test_get_real_name_multi_part_dotted

Check file tests/test_parse.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before itdf8e28495a87954a9d52de70c33ef7225c53b28f
Broken version dated2026-07-25
Modulesqlparse.sql
Units changedNameAliasMixin
Fingerprint27e467384492e07e
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in andialbrecht/sqlparse