mz_sql_parser::ast::display

Trait WithOptionName

Source
pub trait WithOptionName {
    // Provided method
    fn redact_value(&self) -> bool { ... }
}
Expand description

Functions that generalize to AST nodes representing the “name” of a WITH option.

Provided Methods§

Source

fn redact_value(&self) -> bool

Expresses whether or not values should be redacted based on the option name (i.e. the option’s “key”).

§WARNING

Whenever implementing this trait consider very carefully whether or not this value could contain sensitive user data.

§Context

Many statements in MZ use the format WITH (<options>...) to modify the resulting behavior of the statement. Most often these are modeled in the AST as a struct with two fields: an option name and a value.

We do not type check the values of the types until planning, so most values represent arbitrary user input. To prevent leaking any PII in that data, we default to replacing values with the string <REDACTED>.

However, in some cases, the values do not need to be redacted. For our WITH options, knowing which option we’re dealing with should be sufficient to understand if a value needs redaction––so this trait controls redaction on a per-option basis.

§Genericizing WITH options

It would be nice to force every AST node we consider a WITH option to conform to a particular structure––however, we have a proc macro that generates visitors over all of our nodes that inhibits our ability to do this easily. This means, unfortunately, that we cannot rely on compilation guarantees for this and instead must use the honor system.

§Nothing is ever redacted…

In the initial implementation of this trait, no option requires its values to be redacted (except for the one test case). That doesn’t mean there won’t be in the future. When in doubt, take the more conservative approach.

Implementors§

Source§

impl WithOptionName for AvroSchemaOptionName

Source§

impl WithOptionName for ConnectionOptionName

Source§

impl WithOptionName for ContinualTaskOptionName

Source§

impl WithOptionName for CreateConnectionOptionName

Source§

impl WithOptionName for CreateSourceOptionName

Source§

impl WithOptionName for KafkaSinkConfigOptionName

Source§

impl WithOptionName for KafkaSourceConfigOptionName

Source§

impl WithOptionName for LoadGeneratorOptionName

Source§

impl WithOptionName for MaterializedViewOptionName

Source§

impl WithOptionName for MySqlConfigOptionName

Source§

impl WithOptionName for PgConfigOptionName

Source§

impl WithOptionName for MutRecBlockOptionName

Source§

impl WithOptionName for SelectOptionName

Source§

impl WithOptionName for AlterConnectionOptionName

Source§

impl WithOptionName for AlterSourceAddSubsourceOptionName

Source§

impl WithOptionName for ClusterAlterOptionName

Source§

impl WithOptionName for ClusterAlterUntilReadyOptionName

Source§

impl WithOptionName for ClusterFeatureName

Source§

impl WithOptionName for ClusterOptionName

Source§

impl WithOptionName for CopyOptionName

Source§

impl WithOptionName for CreateSinkOptionName

Source§

impl WithOptionName for CreateSubsourceOptionName

Source§

impl WithOptionName for CreateTypeListOptionName

Source§

impl WithOptionName for CreateTypeMapOptionName

Source§

impl WithOptionName for ExplainPlanOptionName

Source§

impl WithOptionName for FetchOptionName

Source§

impl WithOptionName for IndexOptionName

Source§

impl WithOptionName for KafkaBrokerAwsPrivatelinkOptionName

Source§

impl WithOptionName for NetworkPolicyOptionName

Source§

impl WithOptionName for NetworkPolicyRuleOptionName

Source§

impl WithOptionName for ReplicaOptionName

Source§

impl WithOptionName for SubscribeOptionName

Source§

impl WithOptionName for TableFromSourceOptionName

Source§

impl WithOptionName for TableOptionName

Source§

impl<T: AstInfo> WithOptionName for CsrConfigOptionName<T>