Returns `true` iff this `Plan` is allowed to be executed in read-only mode. We use an explicit allow-list, to avoid future additions automatically falling into the `true` category.
(&self)
| 482 | /// We use an explicit allow-list, to avoid future additions automatically |
| 483 | /// falling into the `true` category. |
| 484 | pub fn allowed_in_read_only(&self) -> bool { |
| 485 | match self { |
| 486 | // These two set non-durable session variables, so are okay in |
| 487 | // read-only mode. |
| 488 | Plan::SetVariable(_) => true, |
| 489 | Plan::ResetVariable(_) => true, |
| 490 | Plan::SetTransaction(_) => true, |
| 491 | Plan::StartTransaction(_) => true, |
| 492 | Plan::CommitTransaction(_) => true, |
| 493 | Plan::AbortTransaction(_) => true, |
| 494 | Plan::Select(_) => true, |
| 495 | Plan::EmptyQuery => true, |
| 496 | Plan::ShowAllVariables => true, |
| 497 | Plan::ShowCreate(_) => true, |
| 498 | Plan::ShowColumns(_) => true, |
| 499 | Plan::ShowVariable(_) => true, |
| 500 | Plan::InspectShard(_) => true, |
| 501 | Plan::Subscribe(_) => true, |
| 502 | Plan::CopyTo(_) => true, |
| 503 | Plan::ExplainPlan(_) => true, |
| 504 | Plan::ExplainPushdown(_) => true, |
| 505 | Plan::ExplainTimestamp(_) => true, |
| 506 | Plan::ExplainSinkSchema(_) => true, |
| 507 | Plan::ValidateConnection(_) => true, |
| 508 | _ => false, |
| 509 | } |
| 510 | } |
| 511 | } |
| 512 | |
| 513 | #[derive(Debug)] |