(v: &str)
| 196 | } |
| 197 | |
| 198 | fn decode(v: &str) -> Self { |
| 199 | // Accept both the Rust spelling (`true`/`false`, what `encode` and |
| 200 | // `CREATE CLUSTER ... FEATURES` produce) and the canonical system-var / |
| 201 | // PostgreSQL spellings (`on`/`off`, ...). A cluster-coherent scoped |
| 202 | // override may arrive as the var's canonical `on`/`off`. |
| 203 | match v.trim().to_lowercase().as_str() { |
| 204 | "t" | "true" | "on" | "1" | "y" | "yes" => true, |
| 205 | "f" | "false" | "off" | "0" | "n" | "no" => false, |
| 206 | // The writer only stores values that passed `canonicalize`, so this |
| 207 | // arm is unreachable in practice. Log rather than panic anyway: a |
| 208 | // stored bad value reaching the plan path would otherwise crash the |
| 209 | // optimizer on every query for the affected cluster. Fall back to |
| 210 | // `false`. |
| 211 | other => { |
| 212 | mz_ore::soft_panic_or_log!("invalid boolean optimizer feature override: {other:?}"); |
| 213 | false |
| 214 | } |
| 215 | } |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | #[cfg(test)] |
no test coverage detected