Whole file

David-Wobrock/sqlvalidator

The author described this change as Fix Alias.known_fields for aliased subqueries with specific fields. It counts as a record because the check below fails on the code as it stood at 67334fc9d and passes on 00eab4924, with nothing else changed between the two runs.

Fix saved2021-11-14
Sharing licenceMIT · LICENSE
Change size+4 1

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

Fix Alias.known_fields for aliased subqueries with specific fields

The change

10371037
10381038 @property
10391039 def known_fields(self) -> Set[str]:
1040- return self.expression.known_fields
1040+ return {
1041+ "{}.{}".format(transform(self.alias), f)
1042+ for f in self.expression.known_fields
1043+ }
10411044
10421045
10431046 class Index(Expression):

The check that tells the two apart

failpass·tests/integration/test_validation.py::test_specified_field_from_alias_subquery

Check file tests/integration/test_validation.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 it67334fc9dcc4b7fb166433e0789e6b06ab36d8ef
Broken version dated2021-11-14
Modulesqlvalidator.grammar.sql
Units changedAlias
Fingerprint9cef8029aa365355
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 David-Wobrock/sqlvalidator