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.
Projectandialbrecht/sqlparse
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
| 18 | 18 | ||
| 19 | 19 | def get_real_name(self): | |
| 20 | 20 | """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 | |
| 23 | 26 | return self._get_first_name(dot_idx, real_name=True) | |
| 24 | 27 | ||
| 25 | 28 | def get_alias(self): |
The check that tells the two apart
fail→pass·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
- 2026-07-22Fix function grouping skipped for lowercase 'as' in CREATE TABLE AS SELECT
- 2025-11-29StatementSplitter
- 2025-11-28StatementSplitter
- 2024-07-15StatementSplitter
- 2024-04-13Raise SQLParseError instead of RecursionError.
- 2024-04-13Fix Function.get_parameters(), add Funtion.get_window()