(
scx: &'a StatementContext<'a>,
from: Option<ResolvedSchemaName>,
on_source: Option<ResolvedItemName>,
filter: Option<ShowStatementFilter<Aug>>,
)
| 451 | } |
| 452 | |
| 453 | fn show_tables<'a>( |
| 454 | scx: &'a StatementContext<'a>, |
| 455 | from: Option<ResolvedSchemaName>, |
| 456 | on_source: Option<ResolvedItemName>, |
| 457 | filter: Option<ShowStatementFilter<Aug>>, |
| 458 | ) -> Result<ShowSelect<'a>, PlanError> { |
| 459 | let schema_spec = scx.resolve_optional_schema(&from)?; |
| 460 | let mut query = format!( |
| 461 | "SELECT name, comment |
| 462 | FROM mz_internal.mz_show_tables tables |
| 463 | WHERE tables.schema_id = '{schema_spec}'", |
| 464 | ); |
| 465 | if let Some(on_source) = &on_source { |
| 466 | let on_item = scx.get_item_by_resolved_name(on_source)?; |
| 467 | if on_item.item_type() != CatalogItemType::Source { |
| 468 | sql_bail!( |
| 469 | "cannot show tables on {} because it is a {}", |
| 470 | on_source.full_name_str(), |
| 471 | on_item.item_type(), |
| 472 | ); |
| 473 | } |
| 474 | query += &format!(" AND tables.source_id = '{}'", on_item.id()); |
| 475 | } |
| 476 | ShowSelect::new(scx, query, filter, None, Some(&["name", "comment"])) |
| 477 | } |
| 478 | |
| 479 | fn show_sources<'a>( |
| 480 | scx: &'a StatementContext<'a>, |
no test coverage detected