| 519 | |
| 520 | impl fmt::Display for PlanError { |
| 521 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
| 522 | match self { |
| 523 | Self::Unsupported { feature, discussion_no } => { |
| 524 | write!(f, "{} not yet supported", feature)?; |
| 525 | if let Some(discussion_no) = discussion_no { |
| 526 | write!(f, ", see https://github.com/MaterializeInc/materialize/discussions/{} for more details", discussion_no)?; |
| 527 | } |
| 528 | Ok(()) |
| 529 | } |
| 530 | Self::NeverSupported { feature, documentation_link: documentation_path,.. } => { |
| 531 | write!(f, "{feature} is not supported",)?; |
| 532 | if let Some(documentation_path) = documentation_path { |
| 533 | write!(f, ", for more information consult the documentation at https://materialize.com/docs/{documentation_path}")?; |
| 534 | } |
| 535 | Ok(()) |
| 536 | } |
| 537 | Self::UnknownColumn { table, column, similar: _ } => write!( |
| 538 | f, |
| 539 | "column {} does not exist", |
| 540 | ColumnDisplay { table, column } |
| 541 | ), |
| 542 | Self::UngroupedColumn { table, column } => write!( |
| 543 | f, |
| 544 | "column {} must appear in the GROUP BY clause or be used in an aggregate function", |
| 545 | ColumnDisplay { table, column }, |
| 546 | ), |
| 547 | Self::ItemWithoutColumns { name, item_type } => { |
| 548 | let name = name.quoted(); |
| 549 | write!(f, "{item_type} {name} does not have columns") |
| 550 | } |
| 551 | Self::WrongJoinTypeForLateralColumn { table, column } => write!( |
| 552 | f, |
| 553 | "column {} cannot be referenced from this part of the query: \ |
| 554 | the combining JOIN type must be INNER or LEFT for a LATERAL reference", |
| 555 | ColumnDisplay { table, column }, |
| 556 | ), |
| 557 | Self::AmbiguousColumn(column) => write!( |
| 558 | f, |
| 559 | "column reference {} is ambiguous", |
| 560 | column.quoted() |
| 561 | ), |
| 562 | Self::TooManyColumns { max_num_columns, req_num_columns } => write!( |
| 563 | f, |
| 564 | "attempt to create relation with too many columns, {} max: {}", |
| 565 | req_num_columns, max_num_columns |
| 566 | ), |
| 567 | Self::ColumnAlreadyExists { column_name, object_name } => write!( |
| 568 | f, |
| 569 | "column {} of relation {} already exists", |
| 570 | column_name.quoted(), object_name.quoted(), |
| 571 | ), |
| 572 | Self::AmbiguousTable(table) => write!( |
| 573 | f, |
| 574 | "table reference {} is ambiguous", |
| 575 | table.item.as_str().quoted() |
| 576 | ), |
| 577 | Self::UnknownColumnInUsingClause { column, join_side } => write!( |
| 578 | f, |