Don't store ddl
on schema definitions
#45772
Merged
+23
−66
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
We'll ensure that any consumers that require
ddl
obtain it by visitingthe schema definition. Consequently, we should also stop visiting the
schema definition in the "schema definition builder" methods -- callers
will need to both build a schema definition, and then visit it using a
SchemaCreation
object. This means schema definitions will not be populatedwith SQL type information, or any other information that is set when
the definition is visited.
This PR removes the
ddl
attribute from various schema definitions we'd added it to, and makes it so we're no longer visiting the definitions in the builder methods, but back in the schema statement methods where this was originally taking place.Other Information
This change is being made because storing
ddl
on schema definitions subverts the intention of the Visitor pattern in its original form. We shouldn't be storingddl
on an object and allowing it to leak out to consumers -- instead, callers interacting with schema definition objects should be responsible for visiting the object themselves to produce ddl.cc @matthewd @eileencodes