| 401 | } |
| 402 | |
| 403 | pub fn hint(&self) -> Option<String> { |
| 404 | match self { |
| 405 | Self::DropViewOnMaterializedView(_) => { |
| 406 | Some("Use DROP MATERIALIZED VIEW to remove a materialized view.".into()) |
| 407 | } |
| 408 | Self::DependentObjectsStillExist {..} => Some("Use DROP ... CASCADE to drop the dependent objects too.".into()), |
| 409 | Self::AlterViewOnMaterializedView(_) => { |
| 410 | Some("Use ALTER MATERIALIZED VIEW to rename a materialized view.".into()) |
| 411 | } |
| 412 | Self::ShowCreateViewOnMaterializedView(_) => { |
| 413 | Some("Use SHOW CREATE MATERIALIZED VIEW to show a materialized view.".into()) |
| 414 | } |
| 415 | Self::ExplainViewOnMaterializedView(_) => { |
| 416 | Some("Use EXPLAIN [...] MATERIALIZED VIEW to explain a materialized view.".into()) |
| 417 | } |
| 418 | Self::UnacceptableTimelineName(_) => { |
| 419 | Some("The prefix \"mz_\" is reserved for system timelines.".into()) |
| 420 | } |
| 421 | Self::PostgresConnectionErr { cause } => { |
| 422 | if let Some(cause) = cause.source() { |
| 423 | if let Some(cause) = cause.downcast_ref::<io::Error>() { |
| 424 | if cause.kind() == io::ErrorKind::TimedOut { |
| 425 | return Some( |
| 426 | "Do you have a firewall or security group that is \ |
| 427 | preventing Materialize from connecting to your PostgreSQL server?" |
| 428 | .into(), |
| 429 | ); |
| 430 | } |
| 431 | } |
| 432 | } |
| 433 | None |
| 434 | } |
| 435 | Self::InvalidOptionValue { err, .. } => err.hint(), |
| 436 | Self::UnknownFunction { ..} => Some("No function matches the given name and argument types. You might need to add explicit type casts.".into()), |
| 437 | Self::IndistinctFunction {..} => { |
| 438 | Some("Could not choose a best candidate function. You might need to add explicit type casts.".into()) |
| 439 | } |
| 440 | Self::UnknownOperator {..} => { |
| 441 | Some("No operator matches the given name and argument types. You might need to add explicit type casts.".into()) |
| 442 | } |
| 443 | Self::IndistinctOperator {..} => { |
| 444 | Some("Could not choose a best candidate operator. You might need to add explicit type casts.".into()) |
| 445 | }, |
| 446 | Self::InvalidPrivatelinkAvailabilityZone { supported_azs, ..} => { |
| 447 | let supported_azs_str = supported_azs.iter().join("\n "); |
| 448 | Some(format!("Did you supply an availability zone name instead of an ID? Known availability zone IDs:\n {}", supported_azs_str)) |
| 449 | } |
| 450 | Self::DuplicatePrivatelinkAvailabilityZone { duplicate_azs, ..} => { |
| 451 | let duplicate_azs = duplicate_azs.iter().join("\n "); |
| 452 | Some(format!("Duplicated availability zones:\n {}", duplicate_azs)) |
| 453 | } |
| 454 | Self::InvalidKeysInSubscribeEnvelopeUpsert => { |
| 455 | Some("All keys must be columns on the underlying relation.".into()) |
| 456 | } |
| 457 | Self::InvalidKeysInSubscribeEnvelopeDebezium => { |
| 458 | Some("All keys must be columns on the underlying relation.".into()) |
| 459 | } |
| 460 | Self::DuplicateKeyColumnInSubscribeEnvelope { .. } => { |