# Buggy code
def _lint_references_and_aliases(self, aliases, references, using_cols, parent_select):
    """Check whether any aliases are duplicates.

    NB: Subclasses of this error should override this function.

    """
    # Are any of the aliases the same?
    for a1, a2 in itertools.combinations(aliases, 2):
        # Compare the strings
        if a1[0] == a2[0] and a1[0]:
            # If there are any, then the rest of the code
            # won't make sense so just return here.
            return [
                LintResult(
                    # Reference the element, not the string.
                    anchor=a2[1],
                    description=(
                        "Duplicate table alias {0!r}. Table aliases should be unique."
                    ).format(a2.raw),
                )
            ]
    return None


# Traceback (AttributeError)
Traceback (most recent call last):
File "/Users/florentpezet/.pyenv/versions/sqlfluff-3.7.5/bin/sqlfluff", line 11, in <module>
load_entry_point('sqlfluff', 'console_scripts', 'sqlfluff')()
File "/Users/florentpezet/.pyenv/versions/sqlfluff-3.7.5/lib/python3.7/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/Users/florentpezet/.pyenv/versions/sqlfluff-3.7.5/lib/python3.7/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/Users/florentpezet/.pyenv/versions/sqlfluff-3.7.5/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/florentpezet/.pyenv/versions/sqlfluff-3.7.5/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/florentpezet/.pyenv/versions/sqlfluff-3.7.5/lib/python3.7/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/Users/florentpezet/Documents/sqlfluff/src/sqlfluff/cli/commands.py", line 162, in lint
result = lnt.lint_paths(paths, verbosity=verbose, ignore_non_existent_files=False)
File "/Users/florentpezet/Documents/sqlfluff/src/sqlfluff/linter.py", line 891, in lint_paths
ignore_non_existent_files=ignore_non_existent_files))
File "/Users/florentpezet/Documents/sqlfluff/src/sqlfluff/linter.py", line 877, in lint_path
fix=fix, config=config))
File "/Users/florentpezet/Documents/sqlfluff/src/sqlfluff/linter.py", line 727, in lint_string
lerrs, _, _, _ = crawler.crawl(parsed, dialect=config.get('dialect_obj'))
File "/Users/florentpezet/Documents/sqlfluff/src/sqlfluff/rules/base.py", line 264, in crawl
dialect=dialect)
File "/Users/florentpezet/Documents/sqlfluff/src/sqlfluff/rules/base.py", line 264, in crawl
dialect=dialect)
File "/Users/florentpezet/Documents/sqlfluff/src/sqlfluff/rules/base.py", line 217, in crawl
raw_stack=raw_stack, memory=memory, dialect=dialect)
File "/Users/florentpezet/Documents/sqlfluff/src/sqlfluff/rules/std.py", line 2194, in _eval
return self._lint_references_and_aliases(aliases, reference_buffer, using_cols, parent_select)
File "/Users/florentpezet/Documents/sqlfluff/src/sqlfluff/rules/std.py", line 2119, in _lint_references_and_aliases
"aliases should be unique.").format(a2.raw)
AttributeError: 'tuple' object has no attribute 'raw'

# Fixed code
def _lint_references_and_aliases(self, aliases, references, using_cols, parent_select):
    """Check whether any aliases are duplicates.

    NB: Subclasses of this error should override this function.

    """
    # Are any of the aliases the same?
    for a1, a2 in itertools.combinations(aliases, 2):
        # Compare the strings
        if a1[0] == a2[0] and a1[0]:
            # If there are any, then the rest of the code
            # won't make sense so just return here.
            return [
                LintResult(
                    # Reference the element, not the string.
                    anchor=a2[1],
                    description=(
                        "Duplicate table alias {0!r}. Table aliases should be unique."
                    ).format(a2[0]),
                )
            ]
    return None