From 0e79dec608144f7e7dd77d7a791c8830f8653424 Mon Sep 17 00:00:00 2001 From: Jan Teske Date: Tue, 31 Mar 2026 12:42:21 +0200 Subject: [PATCH 1/3] catalog: builtin view exposing builtin views This commit adds the first constant builtin view exposing builtin objects to the catalog. Specifically, `mz_builtin_views` reports what builtin views exist. It is required to define `mz_views` as a view over the catalog, since the catalog does not contain builtin objects. Further builtin views exposing other builtin object types will be added as needed to support converting more builtin tables. --- src/catalog/src/builtin.rs | 25 +++++-- src/catalog/src/builtin/builtin.rs | 102 +++++++++++++++++++++++++++++ src/pgrepr-consts/src/oid.rs | 1 + 3 files changed, 123 insertions(+), 5 deletions(-) create mode 100644 src/catalog/src/builtin/builtin.rs diff --git a/src/catalog/src/builtin.rs b/src/catalog/src/builtin.rs index 4b7e770788405..621c11d5b03d2 100644 --- a/src/catalog/src/builtin.rs +++ b/src/catalog/src/builtin.rs @@ -22,6 +22,7 @@ //! More information about builtin system tables and types can be found in //! . +mod builtin; pub mod notice; use std::collections::BTreeMap; @@ -14068,7 +14069,7 @@ pub const MZ_ANALYTICS_CLUSTER: BuiltinCluster = BuiltinCluster { /// List of all builtin objects sorted topologically by dependency. pub static BUILTINS_STATIC: LazyLock>> = LazyLock::new(|| { - let mut builtins = vec![ + let mut builtin_types = vec![ Builtin::Type(&TYPE_ANY), Builtin::Type(&TYPE_ANYARRAY), Builtin::Type(&TYPE_ANYELEMENT), @@ -14160,6 +14161,8 @@ pub static BUILTINS_STATIC: LazyLock>> = LazyLock::ne Builtin::Type(&TYPE_ACL_ITEM_ARRAY), Builtin::Type(&TYPE_INTERNAL), ]; + + let mut builtin_funcs = Vec::new(); for (schema, funcs) in &[ (PG_CATALOG_SCHEMA, &*mz_sql::func::PG_CATALOG_BUILTINS), ( @@ -14171,14 +14174,15 @@ pub static BUILTINS_STATIC: LazyLock>> = LazyLock::ne (MZ_UNSAFE_SCHEMA, &*mz_sql::func::MZ_UNSAFE_BUILTINS), ] { for (name, func) in funcs.iter() { - builtins.push(Builtin::Func(BuiltinFunc { + builtin_funcs.push(Builtin::Func(BuiltinFunc { name, schema, inner: func, })); } } - builtins.append(&mut vec![ + + let mut builtin_items = vec![ Builtin::Source(&MZ_CATALOG_RAW), Builtin::Log(&MZ_ARRANGEMENT_SHARING_RAW), Builtin::Log(&MZ_ARRANGEMENT_BATCHES_RAW), @@ -14555,9 +14559,20 @@ pub static BUILTINS_STATIC: LazyLock>> = LazyLock::ne Builtin::View(&MZ_INDEX_ADVICE), Builtin::View(&MZ_MCP_DATA_PRODUCTS), Builtin::View(&MZ_MCP_DATA_PRODUCT_DETAILS), - ]); + ]; + + builtin_items.extend(notice::builtins()); + + // Generate builtin relations reporting builtin objects last, since they need a complete view + // of all other builtins. + let mut builtin_builtins = builtin::builtins(&builtin_items).collect(); - builtins.extend(notice::builtins()); + // Construct the full list of builtins, retaining dependency order. + let mut builtins = Vec::new(); + builtins.append(&mut builtin_types); + builtins.append(&mut builtin_funcs); + builtins.append(&mut builtin_builtins); + builtins.append(&mut builtin_items); builtins }); diff --git a/src/catalog/src/builtin/builtin.rs b/src/catalog/src/builtin/builtin.rs new file mode 100644 index 0000000000000..db37ed5d82f9f --- /dev/null +++ b/src/catalog/src/builtin/builtin.rs @@ -0,0 +1,102 @@ +// Copyright Materialize, Inc. and contributors. All rights reserved. +// +// Use of this software is governed by the Business Source License +// included in the LICENSE file. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0. + +//! Constant builtin views exposing information about builtin objects. + +use itertools::Itertools; +use mz_ore::collections::CollectionExt; +use mz_pgrepr::oid; +use mz_repr::namespaces::MZ_INTERNAL_SCHEMA; +use mz_repr::{RelationDesc, SqlScalarType}; +use mz_sql::ast::display::{AstDisplay, escaped_string_literal}; +use mz_sql::catalog::NameReference; + +use crate::builtin::{Builtin, BuiltinView, PUBLIC_SELECT}; + +/// Generate builtin views reporting the given builtins. +/// +/// Note that `mz_builtin_views`, which reports the existing builtin views, omits the builtin views +/// generated by this function. They are thus hidden from the catalog. This seems acceptable since +/// these views are an implementation detail that exists solely to enable defining the item MVs +/// over the catalog. +/// +/// Used in the [`super::BUILTINS_STATIC`] initializer. +pub(super) fn builtins( + builtin_items: &[Builtin], +) -> impl Iterator> { + let view_iter = builtin_items.iter().filter_map(|b| match b { + Builtin::View(v) => Some(*v), + _ => None, + }); + let views = make_builtin_views(view_iter); + + [views].into_iter().map(|v| { + let static_ref = Box::leak(Box::new(v)); + Builtin::View(static_ref) + }) +} + +fn make_builtin_views<'a>(iter: impl Iterator) -> BuiltinView { + let values = iter + .map(|v| { + let query = mz_sql::parse::parse(v.sql) + .expect("valid sql") + .into_element() + .ast + .to_ast_string_stable(); + let definition = format!("{query};"); + let definition = escaped_string_literal(&definition); + let create_sql = format!("CREATE VIEW \"{}\".\"{}\" AS {query}", v.schema, v.name); + let create_sql = escaped_string_literal(&create_sql); + + let mut privs = v.access.iter().map(|acl| { + let mode = acl.acl_mode.explode().join(","); + format!( + "mz_internal.make_mz_aclitem('{}', '{}', '{}')", + acl.grantee, acl.grantor, mode + ) + }); + let priv_array = format!("ARRAY[{}]", privs.join(",")); + + format!( + "({}::oid, '{}', '{}', {}, {}, {})", + v.oid, v.schema, v.name, definition, priv_array, create_sql + ) + }) + .join(","); + let sql = format!( + " +SELECT oid, schema_name, name, definition, privileges, create_sql +FROM (VALUES {values}) AS v(oid, schema_name, name, definition, privileges, create_sql)" + ); + + BuiltinView { + name: "mz_builtin_views", + schema: MZ_INTERNAL_SCHEMA, + oid: oid::VIEW_MZ_BUILTIN_VIEWS_OID, + desc: RelationDesc::builder() + .with_column("oid", SqlScalarType::Oid.nullable(false)) + .with_column("schema_name", SqlScalarType::String.nullable(false)) + .with_column("name", SqlScalarType::String.nullable(false)) + .with_column("definition", SqlScalarType::String.nullable(false)) + .with_column( + "privileges", + SqlScalarType::Array(Box::new(SqlScalarType::MzAclItem)).nullable(false), + ) + .with_column("create_sql", SqlScalarType::String.nullable(false)) + .with_key(vec![0]) + .with_key(vec![2]) + .with_key(vec![3]) + .with_key(vec![5]) + .finish(), + column_comments: Default::default(), + sql: Box::leak(sql.into_boxed_str()), + access: vec![PUBLIC_SELECT], + } +} diff --git a/src/pgrepr-consts/src/oid.rs b/src/pgrepr-consts/src/oid.rs index 3702d82c4ff92..150cb99d1f4d1 100644 --- a/src/pgrepr-consts/src/oid.rs +++ b/src/pgrepr-consts/src/oid.rs @@ -789,3 +789,4 @@ pub const LOG_MZ_CLUSTER_PROMETHEUS_METRICS_OID: u32 = 17068; pub const FUNC_PARSE_CATALOG_ID_OID: u32 = 17069; pub const FUNC_PARSE_CATALOG_PRIVILEGES_OID: u32 = 17070; pub const VIEW_MZ_MCP_DATA_PRODUCT_DETAILS_OID: u32 = 17071; +pub const VIEW_MZ_BUILTIN_VIEWS_OID: u32 = 17072; From 34d83f470d756c719c68ed4e717db8fc34ff09c0 Mon Sep 17 00:00:00 2001 From: Jan Teske Date: Tue, 31 Mar 2026 14:50:39 +0200 Subject: [PATCH 2/3] sql,expr: add sqlfuncs to support mz_views conversion This commit adds two new internal sqlfuncs to support converting `mz_views` into a view over the catalog. * `parse_catalog_create_sql` parses a create_sql string and returns information extracted from it as JSON * `redact_sql` redacts a given SQL statement --- src/expr/src/scalar.proto | 1 + src/expr/src/scalar.rs | 4 ++ src/expr/src/scalar/func.rs | 14 ++++++- src/expr/src/scalar/func/impls/jsonb.rs | 54 +++++++++++++++++++++++++ src/expr/src/scalar/func/unary.rs | 3 ++ src/pgrepr-consts/src/oid.rs | 2 + src/sql/src/func.rs | 26 +++++++----- src/storage-types/src/errors.rs | 3 ++ test/sqllogictest/oid.slt | 2 + 9 files changed, 99 insertions(+), 10 deletions(-) diff --git a/src/expr/src/scalar.proto b/src/expr/src/scalar.proto index 62fe4f0a273bf..4ef985f02c34f 100644 --- a/src/expr/src/scalar.proto +++ b/src/expr/src/scalar.proto @@ -163,5 +163,6 @@ message ProtoEvalError { google.protobuf.Empty neg_limit = 79; google.protobuf.Empty key_cannot_be_null = 80; string invalid_catalog_json = 81; + string redact_error = 82; } } diff --git a/src/expr/src/scalar.rs b/src/expr/src/scalar.rs index 077e8a6da1102..d3b69d6e764aa 100644 --- a/src/expr/src/scalar.rs +++ b/src/expr/src/scalar.rs @@ -2721,6 +2721,7 @@ pub enum EvalError { AclArrayNullElement, MzAclArrayNullElement, PrettyError(Box), + RedactError(Box), } impl fmt::Display for EvalError { @@ -2830,6 +2831,7 @@ impl fmt::Display for EvalError { } EvalError::Parse(e) => e.fmt(f), EvalError::PrettyError(e) => e.fmt(f), + EvalError::RedactError(e) => e.fmt(f), EvalError::ParseHex(e) => e.fmt(f), EvalError::Internal(s) => write!(f, "internal error: {}", s), EvalError::InfinityOutOfDomain(s) => { @@ -3133,6 +3135,7 @@ impl RustType for EvalError { EvalError::UnterminatedLikeEscapeSequence => UnterminatedLikeEscapeSequence(()), EvalError::Parse(error) => Parse(error.into_proto()), EvalError::PrettyError(error) => PrettyError(error.into_proto()), + EvalError::RedactError(error) => RedactError(error.into_proto()), EvalError::ParseHex(error) => ParseHex(error.into_proto()), EvalError::Internal(v) => Internal(v.into_proto()), EvalError::InfinityOutOfDomain(v) => InfinityOutOfDomain(v.into_proto()), @@ -3319,6 +3322,7 @@ impl RustType for EvalError { MzAclArrayNullElement(()) => Ok(EvalError::MzAclArrayNullElement), InvalidIanaTimezoneId(s) => Ok(EvalError::InvalidIanaTimezoneId(s.into())), PrettyError(s) => Ok(EvalError::PrettyError(s.into())), + RedactError(s) => Ok(EvalError::RedactError(s.into())), }, None => Err(TryFromProtoError::missing_field("ProtoEvalError::kind")), } diff --git a/src/expr/src/scalar/func.rs b/src/expr/src/scalar/func.rs index 1ccb94f55e95b..1419b0dbd85b7 100644 --- a/src/expr/src/scalar/func.rs +++ b/src/expr/src/scalar/func.rs @@ -44,7 +44,7 @@ use mz_repr::{ ArrayRustType, Datum, DatumList, DatumMap, ExcludeNull, FromDatum, InputDatumType, Row, RowArena, SqlScalarType, strconv, }; -use mz_sql_parser::ast::display::FormatMode; +use mz_sql_parser::ast::display::{AstDisplay, FormatMode}; use mz_sql_pretty::{PrettyConfig, pretty_str}; use num::traits::CheckedNeg; use sha1::Sha1; @@ -2318,6 +2318,18 @@ fn pretty_sql<'a>(sql: &str, width: i32, temp_storage: &'a RowArena) -> Result<& Ok(pretty) } +#[sqlfunc] +fn redact_sql(sql: &str) -> Result { + let stmts = mz_sql_parser::parser::parse_statements(sql) + .map_err(|e| EvalError::RedactError(e.to_string().into()))?; + match stmts.len() { + 1 => Ok(stmts[0].ast.to_ast_string_redacted()), + n => Err(EvalError::RedactError( + format!("expected a single statement, found {n}").into(), + )), + } +} + #[sqlfunc(propagates_nulls = true)] fn starts_with(a: &str, b: &str) -> bool { a.starts_with(b) diff --git a/src/expr/src/scalar/func/impls/jsonb.rs b/src/expr/src/scalar/func/impls/jsonb.rs index 57f0a5e483656..72c7c8968f991 100644 --- a/src/expr/src/scalar/func/impls/jsonb.rs +++ b/src/expr/src/scalar/func/impls/jsonb.rs @@ -7,6 +7,7 @@ // the Business Source License, use of this software will be governed // by the Apache License, Version 2.0. +use std::collections::BTreeMap; use std::fmt; use mz_expr_derive::sqlfunc; @@ -16,7 +17,9 @@ use mz_repr::adt::mz_acl_item::{AclMode, MzAclItem}; use mz_repr::adt::numeric::{self, Numeric, NumericMaxScale}; use mz_repr::role_id::RoleId; use mz_repr::{ArrayRustType, Datum, Row, RowPacker, SqlColumnType, SqlScalarType, strconv}; +use mz_sql_parser::ast::display::AstDisplay; use serde::{Deserialize, Serialize}; +use serde_json::json; use crate::EvalError; use crate::scalar::func::EagerUnaryFunc; @@ -354,3 +357,54 @@ fn parse_catalog_privileges<'a>(a: JsonbRef<'a>) -> Result(a: &'a str) -> Result { + let parse = || -> Result { + let mut stmts = mz_sql_parser::parser::parse_statements(a) + .map_err(|e| format!("failed to parse create_sql: {e}"))?; + let stmt = match stmts.len() { + 1 => stmts.remove(0).ast, + n => return Err(format!("expected a single statement, found {n}")), + }; + + let mut info = BTreeMap::<&str, serde_json::Value>::new(); + + use mz_sql_parser::ast::Statement::*; + let item_type = match stmt { + CreateSecret(_) => "secret", + CreateConnection(_) => "connection", + CreateView(stmt) => { + let mut definition = stmt.definition.query.to_ast_string_stable(); + definition.push(';'); + info.insert("definition", json!(definition)); + + "view" + } + CreateMaterializedView(_) => "materialized-view", + CreateContinualTask(_) => "continual-task", + CreateTable(_) | CreateTableFromSource(_) => "table", + CreateSource(_) | CreateWebhookSource(_) => "source", + CreateSubsource(_) => "subsource", + CreateSink(_) => "sink", + CreateIndex(_) => "index", + CreateType(_) => "type", + _ => return Err("not a CREATE item statement".into()), + }; + info.insert("type", json!(item_type)); + + let info = info.into_iter().map(|(k, v)| (k.to_string(), v)).collect(); + Ok(info) + }; + + let val = parse().map_err(|e| EvalError::InvalidCatalogJson(e.into()))?; + let jsonb = Jsonb::from_serde_json(val).expect("valid JSONB"); + Ok(jsonb) +} diff --git a/src/expr/src/scalar/func/unary.rs b/src/expr/src/scalar/func/unary.rs index 01dfda0db280b..0e3a8d1d7404c 100644 --- a/src/expr/src/scalar/func/unary.rs +++ b/src/expr/src/scalar/func/unary.rs @@ -17,6 +17,7 @@ use std::{fmt, str}; use mz_repr::{Datum, InputDatumType, OutputDatumType, ReprColumnType, RowArena, SqlColumnType}; +use crate::scalar::func::RedactSql; use crate::scalar::func::impls::*; use crate::{EvalError, MirScalarExpr}; @@ -461,8 +462,10 @@ derive_unary!( JsonbTypeof, JsonbStripNulls, JsonbPretty, + ParseCatalogCreateSql, ParseCatalogId, ParseCatalogPrivileges, + RedactSql, RoundFloat32, RoundFloat64, RoundNumeric, diff --git a/src/pgrepr-consts/src/oid.rs b/src/pgrepr-consts/src/oid.rs index 150cb99d1f4d1..d42403aa1f2bc 100644 --- a/src/pgrepr-consts/src/oid.rs +++ b/src/pgrepr-consts/src/oid.rs @@ -790,3 +790,5 @@ pub const FUNC_PARSE_CATALOG_ID_OID: u32 = 17069; pub const FUNC_PARSE_CATALOG_PRIVILEGES_OID: u32 = 17070; pub const VIEW_MZ_MCP_DATA_PRODUCT_DETAILS_OID: u32 = 17071; pub const VIEW_MZ_BUILTIN_VIEWS_OID: u32 = 17072; +pub const FUNC_PARSE_CATALOG_CREATE_SQL_OID: u32 = 17073; +pub const FUNC_REDACT_SQL_OID: u32 = 17074; diff --git a/src/sql/src/func.rs b/src/sql/src/func.rs index 7697e6879591b..de61b8811c0de 100644 --- a/src/sql/src/func.rs +++ b/src/sql/src/func.rs @@ -4832,15 +4832,6 @@ pub static MZ_INTERNAL_BUILTINS: LazyLock> = LazyLo params!(String, String, String) => VariadicFunc::from(variadic::MakeMzAclItem) => MzAclItem, oid::FUNC_MAKE_MZ_ACL_ITEM_OID; }, - "parse_catalog_id" => Scalar { - params!(Jsonb) => UnaryFunc::ParseCatalogId(func::ParseCatalogId) - => String, oid::FUNC_PARSE_CATALOG_ID_OID; - }, - "parse_catalog_privileges" => Scalar { - params!(Jsonb) => UnaryFunc::ParseCatalogPrivileges(func::ParseCatalogPrivileges) - => SqlScalarType::Array(Box::new(SqlScalarType::MzAclItem)), - oid::FUNC_PARSE_CATALOG_PRIVILEGES_OID; - }, "mz_acl_item_contains_privilege" => Scalar { params!(MzAclItem, String) => BinaryFunc::from(func::MzAclItemContainsPrivilege) @@ -5235,6 +5226,23 @@ pub static MZ_INTERNAL_BUILTINS: LazyLock> = LazyLo params!(String) => UnaryFunc::MzValidateRolePrivilege( func::MzValidateRolePrivilege, ) => Bool, oid::FUNC_MZ_VALIDATE_ROLE_PRIVILEGE_OID; + }, + "parse_catalog_create_sql" => Scalar { + params!(String) => UnaryFunc::ParseCatalogCreateSql(func::ParseCatalogCreateSql) + => Jsonb, oid::FUNC_PARSE_CATALOG_CREATE_SQL_OID; + }, + "parse_catalog_id" => Scalar { + params!(Jsonb) => UnaryFunc::ParseCatalogId(func::ParseCatalogId) + => String, oid::FUNC_PARSE_CATALOG_ID_OID; + }, + "parse_catalog_privileges" => Scalar { + params!(Jsonb) => UnaryFunc::ParseCatalogPrivileges(func::ParseCatalogPrivileges) + => SqlScalarType::Array(Box::new(SqlScalarType::MzAclItem)), + oid::FUNC_PARSE_CATALOG_PRIVILEGES_OID; + }, + "redact_sql" => Scalar { + params!(String) => UnaryFunc::RedactSql(func::RedactSql) + => String, oid::FUNC_REDACT_SQL_OID; } } }); diff --git a/src/storage-types/src/errors.rs b/src/storage-types/src/errors.rs index 00fbc7548e07a..2959e53c8be53 100644 --- a/src/storage-types/src/errors.rs +++ b/src/storage-types/src/errors.rs @@ -870,6 +870,9 @@ mod columnation { EvalError::PrettyError(x) => { EvalError::PrettyError(self.string_region.copy(x)) } + EvalError::RedactError(x) => { + EvalError::RedactError(self.string_region.copy(x)) + } }; let reference = self.eval_error_region.copy_iter(once(err)); let boxed = unsafe { Box::from_raw(reference.as_mut_ptr()) }; diff --git a/test/sqllogictest/oid.slt b/test/sqllogictest/oid.slt index f5bded4ddf950..bebb6f346f1fa 100644 --- a/test/sqllogictest/oid.slt +++ b/test/sqllogictest/oid.slt @@ -1179,3 +1179,5 @@ SELECT oid, name FROM mz_objects WHERE id LIKE 's%' AND oid < 20000 ORDER BY oid 17069 parse_catalog_id 17070 parse_catalog_privileges 17071 mz_mcp_data_product_details +17073 parse_catalog_create_sql +17074 redact_sql From d9ce0880eab6fc81e1ffea9d49b39f3ae0fbee32 Mon Sep 17 00:00:00 2001 From: Jan Teske Date: Tue, 31 Mar 2026 14:26:53 +0200 Subject: [PATCH 3/3] catalog: convert mz_views into a view over the catalog --- .../src/catalog/builtin_table_updates.rs | 55 +------ .../catalog/open/builtin_schema_migration.rs | 6 + src/catalog/src/builtin.rs | 146 ++++++++++++------ src/pgrepr-consts/src/oid.rs | 2 +- ...istinct_arrangements_mz_catalog_server.slt | 3 +- .../information_schema_tables.slt | 2 +- .../mz_catalog_server_index_accounting.slt | 146 +++++++++--------- test/sqllogictest/object_ownership.slt | 4 +- test/testdrive/catalog.td | 4 +- 9 files changed, 193 insertions(+), 175 deletions(-) diff --git a/src/adapter/src/catalog/builtin_table_updates.rs b/src/adapter/src/catalog/builtin_table_updates.rs index e056cbbab9200..9c1b4c6d15227 100644 --- a/src/adapter/src/catalog/builtin_table_updates.rs +++ b/src/adapter/src/catalog/builtin_table_updates.rs @@ -26,7 +26,7 @@ use mz_catalog::builtin::{ MZ_POSTGRES_SOURCES, MZ_PSEUDO_TYPES, MZ_REPLACEMENTS, MZ_ROLE_AUTH, MZ_ROLE_PARAMETERS, MZ_ROLES, MZ_SECRETS, MZ_SESSIONS, MZ_SINKS, MZ_SOURCE_REFERENCES, MZ_SOURCES, MZ_SQL_SERVER_SOURCE_TABLES, MZ_SSH_TUNNEL_CONNECTIONS, MZ_STORAGE_USAGE_BY_SHARD, - MZ_SUBSCRIPTIONS, MZ_SYSTEM_PRIVILEGES, MZ_TABLES, MZ_TYPE_PG_METADATA, MZ_TYPES, MZ_VIEWS, + MZ_SUBSCRIPTIONS, MZ_SYSTEM_PRIVILEGES, MZ_TABLES, MZ_TYPE_PG_METADATA, MZ_TYPES, MZ_WEBHOOKS_SOURCES, }; use mz_catalog::config::AwsPrincipalContext; @@ -34,7 +34,7 @@ use mz_catalog::durable::SourceReferences; use mz_catalog::memory::error::{Error, ErrorKind}; use mz_catalog::memory::objects::{ CatalogEntry, CatalogItem, ClusterVariant, Connection, ContinualTask, DataSourceDesc, Func, - Index, MaterializedView, Sink, Table, TableDataSource, Type, View, + Index, MaterializedView, Sink, Table, TableDataSource, Type, }; use mz_controller::clusters::{ ManagedReplicaAvailabilityZones, ManagedReplicaLocation, ReplicaLocation, @@ -633,9 +633,6 @@ impl CatalogState { updates } - CatalogItem::View(view) => { - self.pack_view_update(id, oid, schema_id, name, owner_id, privileges, view, diff) - } CatalogItem::MaterializedView(mview) => self.pack_materialized_view_update( id, oid, schema_id, name, owner_id, privileges, mview, diff, ), @@ -657,6 +654,7 @@ impl CatalogState { CatalogItem::ContinualTask(ct) => self.pack_continual_task_update( id, oid, schema_id, name, owner_id, privileges, ct, diff, ), + CatalogItem::View(_) => Vec::new(), }; if !entry.item().is_temporary() { @@ -1221,53 +1219,6 @@ impl CatalogState { Ok(BuiltinTableUpdate::row(id, row, diff)) } - fn pack_view_update( - &self, - id: CatalogItemId, - oid: u32, - schema_id: &SchemaSpecifier, - name: &str, - owner_id: &RoleId, - privileges: Datum, - view: &View, - diff: Diff, - ) -> Vec> { - let create_stmt = mz_sql::parse::parse(&view.create_sql) - .unwrap_or_else(|e| { - panic!( - "create_sql cannot be invalid: `{}` --- error: `{}`", - view.create_sql, e - ) - }) - .into_element() - .ast; - let query = match &create_stmt { - Statement::CreateView(stmt) => &stmt.definition.query, - _ => unreachable!(), - }; - - let mut query_string = query.to_ast_string_stable(); - // PostgreSQL appends a semicolon in `pg_views.definition`, we - // do the same for compatibility's sake. - query_string.push(';'); - - vec![BuiltinTableUpdate::row( - &*MZ_VIEWS, - Row::pack_slice(&[ - Datum::String(&id.to_string()), - Datum::UInt32(oid), - Datum::String(&schema_id.to_string()), - Datum::String(name), - Datum::String(&query_string), - Datum::String(&owner_id.to_string()), - privileges, - Datum::String(&view.create_sql), - Datum::String(&create_stmt.to_ast_string_redacted()), - ]), - diff, - )] - } - fn pack_materialized_view_update( &self, id: CatalogItemId, diff --git a/src/adapter/src/catalog/open/builtin_schema_migration.rs b/src/adapter/src/catalog/open/builtin_schema_migration.rs index 6ee52dfdb53d4..6f37d4f5ff0ac 100644 --- a/src/adapter/src/catalog/open/builtin_schema_migration.rs +++ b/src/adapter/src/catalog/open/builtin_schema_migration.rs @@ -152,6 +152,12 @@ static MIGRATIONS: LazyLock> = LazyLock::new(|| { MZ_INTERNAL_SCHEMA, "mz_pending_cluster_replicas", ), + MigrationStep::replacement( + "26.19.0-dev.0", + CatalogItemType::MaterializedView, + MZ_CATALOG_SCHEMA, + "mz_views", + ), ] }); diff --git a/src/catalog/src/builtin.rs b/src/catalog/src/builtin.rs index 621c11d5b03d2..152f87463a62a 100644 --- a/src/catalog/src/builtin.rs +++ b/src/catalog/src/builtin.rs @@ -2832,48 +2832,108 @@ pub static MZ_SINKS: LazyLock = LazyLock::new(|| { access: vec![PUBLIC_SELECT], } }); -pub static MZ_VIEWS: LazyLock = LazyLock::new(|| BuiltinTable { - name: "mz_views", - schema: MZ_CATALOG_SCHEMA, - oid: oid::TABLE_MZ_VIEWS_OID, - desc: RelationDesc::builder() - .with_column("id", SqlScalarType::String.nullable(false)) - .with_column("oid", SqlScalarType::Oid.nullable(false)) - .with_column("schema_id", SqlScalarType::String.nullable(false)) - .with_column("name", SqlScalarType::String.nullable(false)) - .with_column("definition", SqlScalarType::String.nullable(false)) - .with_column("owner_id", SqlScalarType::String.nullable(false)) - .with_column( - "privileges", - SqlScalarType::Array(Box::new(SqlScalarType::MzAclItem)).nullable(false), - ) - .with_column("create_sql", SqlScalarType::String.nullable(false)) - .with_column("redacted_create_sql", SqlScalarType::String.nullable(false)) - .with_key(vec![0]) - .with_key(vec![1]) - .finish(), - column_comments: BTreeMap::from_iter([ - ("id", "Materialize's unique ID for the view."), - ("oid", "A PostgreSQL-compatible OID for the view."), - ( - "schema_id", - "The ID of the schema to which the view belongs. Corresponds to `mz_schemas.id`.", - ), - ("name", "The name of the view."), - ("definition", "The view definition (a `SELECT` query)."), - ( - "owner_id", - "The role ID of the owner of the view. Corresponds to `mz_roles.id`.", - ), - ("privileges", "The privileges belonging to the view."), - ("create_sql", "The `CREATE` SQL statement for the view."), - ( - "redacted_create_sql", - "The redacted `CREATE` SQL statement for the view.", - ), - ]), - is_retained_metrics_object: false, - access: vec![PUBLIC_SELECT], +pub static MZ_VIEWS: LazyLock = LazyLock::new(|| { + BuiltinMaterializedView { + name: "mz_views", + schema: MZ_CATALOG_SCHEMA, + oid: oid::MV_MZ_VIEWS_OID, + desc: RelationDesc::builder() + .with_column("id", SqlScalarType::String.nullable(false)) + .with_column("oid", SqlScalarType::Oid.nullable(false)) + .with_column("schema_id", SqlScalarType::String.nullable(false)) + .with_column("name", SqlScalarType::String.nullable(false)) + .with_column("definition", SqlScalarType::String.nullable(false)) + .with_column("owner_id", SqlScalarType::String.nullable(false)) + .with_column( + "privileges", + SqlScalarType::Array(Box::new(SqlScalarType::MzAclItem)).nullable(false), + ) + .with_column("create_sql", SqlScalarType::String.nullable(false)) + .with_column("redacted_create_sql", SqlScalarType::String.nullable(false)) + .with_key(vec![0]) + .with_key(vec![1]) + .finish(), + column_comments: BTreeMap::from_iter([ + ("id", "Materialize's unique ID for the view."), + ("oid", "A PostgreSQL-compatible OID for the view."), + ( + "schema_id", + "The ID of the schema to which the view belongs. Corresponds to `mz_schemas.id`.", + ), + ("name", "The name of the view."), + ("definition", "The view definition (a `SELECT` query)."), + ( + "owner_id", + "The role ID of the owner of the view. Corresponds to `mz_roles.id`.", + ), + ("privileges", "The privileges belonging to the view."), + ("create_sql", "The `CREATE` SQL statement for the view."), + ( + "redacted_create_sql", + "The redacted `CREATE` SQL statement for the view.", + ), + ]), + sql: " +IN CLUSTER mz_catalog_server +WITH ( + ASSERT NOT NULL id, + ASSERT NOT NULL oid, + ASSERT NOT NULL schema_id, + ASSERT NOT NULL name, + ASSERT NOT NULL definition, + ASSERT NOT NULL owner_id, + ASSERT NOT NULL privileges, + ASSERT NOT NULL create_sql, + ASSERT NOT NULL redacted_create_sql +) AS +WITH + user_views AS ( + SELECT + mz_internal.parse_catalog_id(data->'key'->'gid') AS id, + (data->'value'->>'oid')::oid AS oid, + mz_internal.parse_catalog_id(data->'value'->'schema_id') AS schema_id, + data->'value'->>'name' AS name, + (mz_internal.parse_catalog_create_sql(data->'value'->'definition'->'V1'->>'create_sql'))->>'definition' AS definition, + mz_internal.parse_catalog_id(data->'value'->'owner_id') AS owner_id, + mz_internal.parse_catalog_privileges(data->'value'->'privileges') AS privileges, + data->'value'->'definition'->'V1'->>'create_sql' AS create_sql, + mz_internal.redact_sql(data->'value'->'definition'->'V1'->>'create_sql') AS redacted_create_sql + FROM mz_internal.mz_catalog_raw + WHERE + data->>'kind' = 'Item' AND + mz_internal.parse_catalog_create_sql(data->'value'->'definition'->'V1'->>'create_sql')->>'type' = 'view' + ), + builtin_mappings AS ( + SELECT + data->'key'->>'schema_name' AS schema_name, + data->'key'->>'object_name' AS name, + 's' || (data->'value'->>'catalog_id') AS id + FROM mz_internal.mz_catalog_raw + WHERE + data->>'kind' = 'GidMapping' AND + data->'key'->>'object_type' = '4' + ), + builtin_views AS ( + SELECT + m.id, + v.oid, + s.id AS schema_id, + v.name, + v.definition, + 's1' AS owner_id, + v.privileges, + v.create_sql, + mz_internal.redact_sql(v.create_sql) AS redacted_create_sql + FROM mz_internal.mz_builtin_views v + JOIN builtin_mappings m USING (schema_name, name) + JOIN mz_schemas s ON s.name = v.schema_name + WHERE s.database_id IS NULL + ) +SELECT * FROM user_views +UNION ALL +SELECT * FROM builtin_views", + access: vec![PUBLIC_SELECT], + } }); pub static MZ_MATERIALIZED_VIEWS: LazyLock = LazyLock::new(|| BuiltinTable { name: "mz_materialized_views", @@ -14234,7 +14294,7 @@ pub static BUILTINS_STATIC: LazyLock>> = LazyLock::ne Builtin::Table(&MZ_SQL_SERVER_SOURCE_TABLES), Builtin::Table(&MZ_KAFKA_SOURCE_TABLES), Builtin::Table(&MZ_SINKS), - Builtin::Table(&MZ_VIEWS), + Builtin::MaterializedView(&MZ_VIEWS), Builtin::Table(&MZ_MATERIALIZED_VIEWS), Builtin::Table(&MZ_MATERIALIZED_VIEW_REFRESH_STRATEGIES), Builtin::Table(&MZ_TYPES), diff --git a/src/pgrepr-consts/src/oid.rs b/src/pgrepr-consts/src/oid.rs index d42403aa1f2bc..ba5f5992e945c 100644 --- a/src/pgrepr-consts/src/oid.rs +++ b/src/pgrepr-consts/src/oid.rs @@ -434,7 +434,7 @@ pub const TABLE_MZ_CONNECTIONS_OID: u32 = 16708; pub const TABLE_MZ_SSH_TUNNEL_CONNECTIONS_OID: u32 = 16709; pub const TABLE_MZ_SOURCES_OID: u32 = 16710; pub const TABLE_MZ_SINKS_OID: u32 = 16711; -pub const TABLE_MZ_VIEWS_OID: u32 = 16712; +pub const MV_MZ_VIEWS_OID: u32 = 16712; pub const TABLE_MZ_MATERIALIZED_VIEWS_OID: u32 = 16713; pub const TABLE_MZ_TYPES_OID: u32 = 16714; pub const TABLE_MZ_TYPE_PG_METADATA_OID: u32 = 16715; diff --git a/test/sqllogictest/distinct_arrangements_mz_catalog_server.slt b/test/sqllogictest/distinct_arrangements_mz_catalog_server.slt index dcc80e99fe289..b5b3edfb64b6b 100644 --- a/test/sqllogictest/distinct_arrangements_mz_catalog_server.slt +++ b/test/sqllogictest/distinct_arrangements_mz_catalog_server.slt @@ -90,6 +90,7 @@ ArrangeBy[[Column(0,␠"replica_id")]]-errors 5 ArrangeBy[[Column(0,␠"role_oid")]] 1 ArrangeBy[[Column(0,␠"schema_id")]] 6 ArrangeBy[[Column(0,␠"schema_id")]]-errors 6 +ArrangeBy[[Column(0,␠"schema_name")]] 1 ArrangeBy[[Column(0,␠"self")]] 1 ArrangeBy[[Column(0,␠"session_id")]] 1 ArrangeBy[[Column(0,␠"shard_id"),␠Column(2,␠"collection_timestamp")]] 1 @@ -109,7 +110,7 @@ ArrangeBy[[Column(1,␠"element_id")]] 2 ArrangeBy[[Column(1,␠"id")]] 1 ArrangeBy[[Column(1,␠"id")]]-errors 1 ArrangeBy[[Column(1,␠"id_to_use")]] 1 -ArrangeBy[[Column(1,␠"name")]] 1 +ArrangeBy[[Column(1,␠"name")]] 2 ArrangeBy[[Column(1,␠"name")]]-errors 1 ArrangeBy[[Column(1,␠"nspname")]] 1 ArrangeBy[[Column(1,␠"nspname")]]-errors 1 diff --git a/test/sqllogictest/information_schema_tables.slt b/test/sqllogictest/information_schema_tables.slt index c23cd604ecf85..40abed54afeef 100644 --- a/test/sqllogictest/information_schema_tables.slt +++ b/test/sqllogictest/information_schema_tables.slt @@ -266,7 +266,7 @@ BASE TABLE materialize mz_catalog mz_views -BASE TABLE +MATERIALIZED VIEW materialize mz_internal mz_activity_log_thinned diff --git a/test/sqllogictest/mz_catalog_server_index_accounting.slt b/test/sqllogictest/mz_catalog_server_index_accounting.slt index bb358d195f562..73f434a197261 100644 --- a/test/sqllogictest/mz_catalog_server_index_accounting.slt +++ b/test/sqllogictest/mz_catalog_server_index_accounting.slt @@ -37,100 +37,100 @@ mz_arrangement_heap_capacity_raw_s2_primary_idx CREATE␠INDEX␠"mz_arrangemen mz_arrangement_heap_size_raw_s2_primary_idx CREATE␠INDEX␠"mz_arrangement_heap_size_raw_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_arrangement_heap_size_raw"␠("operator_id",␠"worker_id") mz_arrangement_records_raw_s2_primary_idx CREATE␠INDEX␠"mz_arrangement_records_raw_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_arrangement_records_raw"␠("operator_id",␠"worker_id") mz_arrangement_sharing_raw_s2_primary_idx CREATE␠INDEX␠"mz_arrangement_sharing_raw_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_arrangement_sharing_raw"␠("operator_id",␠"worker_id") -mz_cluster_deployment_lineage_ind CREATE␠INDEX␠"mz_cluster_deployment_lineage_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s738␠AS␠"mz_internal"."mz_cluster_deployment_lineage"]␠("cluster_id") +mz_cluster_deployment_lineage_ind CREATE␠INDEX␠"mz_cluster_deployment_lineage_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s741␠AS␠"mz_internal"."mz_cluster_deployment_lineage"]␠("cluster_id") mz_cluster_prometheus_metrics_s2_primary_idx CREATE␠INDEX␠"mz_cluster_prometheus_metrics_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_cluster_prometheus_metrics"␠("process_id",␠"metric_name",␠"labels") -mz_cluster_replica_frontiers_ind CREATE␠INDEX␠"mz_cluster_replica_frontiers_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s732␠AS␠"mz_catalog"."mz_cluster_replica_frontiers"]␠("object_id") -mz_cluster_replica_history_ind CREATE␠INDEX␠"mz_cluster_replica_history_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s595␠AS␠"mz_internal"."mz_cluster_replica_history"]␠("dropped_at") -mz_cluster_replica_metrics_history_ind CREATE␠INDEX␠"mz_cluster_replica_metrics_history_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s505␠AS␠"mz_internal"."mz_cluster_replica_metrics_history"]␠("replica_id") -mz_cluster_replica_metrics_ind CREATE␠INDEX␠"mz_cluster_replica_metrics_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s506␠AS␠"mz_internal"."mz_cluster_replica_metrics"]␠("replica_id") -mz_cluster_replica_name_history_ind CREATE␠INDEX␠"mz_cluster_replica_name_history_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s596␠AS␠"mz_internal"."mz_cluster_replica_name_history"]␠("id") -mz_cluster_replica_sizes_ind CREATE␠INDEX␠"mz_cluster_replica_sizes_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s507␠AS␠"mz_catalog"."mz_cluster_replica_sizes"]␠("size") -mz_cluster_replica_status_history_ind CREATE␠INDEX␠"mz_cluster_replica_status_history_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s508␠AS␠"mz_internal"."mz_cluster_replica_status_history"]␠("replica_id") -mz_cluster_replica_statuses_ind CREATE␠INDEX␠"mz_cluster_replica_statuses_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s509␠AS␠"mz_internal"."mz_cluster_replica_statuses"]␠("replica_id") -mz_cluster_replicas_ind CREATE␠INDEX␠"mz_cluster_replicas_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s504␠AS␠"mz_catalog"."mz_cluster_replicas"]␠("id") -mz_clusters_ind CREATE␠INDEX␠"mz_clusters_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s498␠AS␠"mz_catalog"."mz_clusters"]␠("id") -mz_columns_ind CREATE␠INDEX␠"mz_columns_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s469␠AS␠"mz_catalog"."mz_columns"]␠("name") -mz_comments_ind CREATE␠INDEX␠"mz_comments_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s521␠AS␠"mz_internal"."mz_comments"]␠("id") +mz_cluster_replica_frontiers_ind CREATE␠INDEX␠"mz_cluster_replica_frontiers_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s735␠AS␠"mz_catalog"."mz_cluster_replica_frontiers"]␠("object_id") +mz_cluster_replica_history_ind CREATE␠INDEX␠"mz_cluster_replica_history_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s598␠AS␠"mz_internal"."mz_cluster_replica_history"]␠("dropped_at") +mz_cluster_replica_metrics_history_ind CREATE␠INDEX␠"mz_cluster_replica_metrics_history_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s508␠AS␠"mz_internal"."mz_cluster_replica_metrics_history"]␠("replica_id") +mz_cluster_replica_metrics_ind CREATE␠INDEX␠"mz_cluster_replica_metrics_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s509␠AS␠"mz_internal"."mz_cluster_replica_metrics"]␠("replica_id") +mz_cluster_replica_name_history_ind CREATE␠INDEX␠"mz_cluster_replica_name_history_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s599␠AS␠"mz_internal"."mz_cluster_replica_name_history"]␠("id") +mz_cluster_replica_sizes_ind CREATE␠INDEX␠"mz_cluster_replica_sizes_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s510␠AS␠"mz_catalog"."mz_cluster_replica_sizes"]␠("size") +mz_cluster_replica_status_history_ind CREATE␠INDEX␠"mz_cluster_replica_status_history_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s511␠AS␠"mz_internal"."mz_cluster_replica_status_history"]␠("replica_id") +mz_cluster_replica_statuses_ind CREATE␠INDEX␠"mz_cluster_replica_statuses_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s512␠AS␠"mz_internal"."mz_cluster_replica_statuses"]␠("replica_id") +mz_cluster_replicas_ind CREATE␠INDEX␠"mz_cluster_replicas_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s507␠AS␠"mz_catalog"."mz_cluster_replicas"]␠("id") +mz_clusters_ind CREATE␠INDEX␠"mz_clusters_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s501␠AS␠"mz_catalog"."mz_clusters"]␠("id") +mz_columns_ind CREATE␠INDEX␠"mz_columns_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s472␠AS␠"mz_catalog"."mz_columns"]␠("name") +mz_comments_ind CREATE␠INDEX␠"mz_comments_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s524␠AS␠"mz_internal"."mz_comments"]␠("id") mz_compute_dataflow_global_ids_per_worker_s2_primary_idx CREATE␠INDEX␠"mz_compute_dataflow_global_ids_per_worker_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_compute_dataflow_global_ids_per_worker"␠("id",␠"worker_id") -mz_compute_dependencies_ind CREATE␠INDEX␠"mz_compute_dependencies_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s721␠AS␠"mz_internal"."mz_compute_dependencies"]␠("dependency_id") +mz_compute_dependencies_ind CREATE␠INDEX␠"mz_compute_dependencies_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s724␠AS␠"mz_internal"."mz_compute_dependencies"]␠("dependency_id") mz_compute_error_counts_raw_s2_primary_idx CREATE␠INDEX␠"mz_compute_error_counts_raw_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_compute_error_counts_raw"␠("export_id",␠"worker_id") mz_compute_exports_per_worker_s2_primary_idx CREATE␠INDEX␠"mz_compute_exports_per_worker_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_compute_exports_per_worker"␠("export_id",␠"worker_id") mz_compute_frontiers_per_worker_s2_primary_idx CREATE␠INDEX␠"mz_compute_frontiers_per_worker_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_compute_frontiers_per_worker"␠("export_id",␠"worker_id") -mz_compute_hydration_times_ind CREATE␠INDEX␠"mz_compute_hydration_times_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s728␠AS␠"mz_internal"."mz_compute_hydration_times"]␠("replica_id") +mz_compute_hydration_times_ind CREATE␠INDEX␠"mz_compute_hydration_times_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s731␠AS␠"mz_internal"."mz_compute_hydration_times"]␠("replica_id") mz_compute_hydration_times_per_worker_s2_primary_idx CREATE␠INDEX␠"mz_compute_hydration_times_per_worker_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_compute_hydration_times_per_worker"␠("export_id",␠"worker_id") mz_compute_import_frontiers_per_worker_s2_primary_idx CREATE␠INDEX␠"mz_compute_import_frontiers_per_worker_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_compute_import_frontiers_per_worker"␠("export_id",␠"import_id",␠"worker_id") mz_compute_lir_mapping_per_worker_s2_primary_idx CREATE␠INDEX␠"mz_compute_lir_mapping_per_worker_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_compute_lir_mapping_per_worker"␠("global_id",␠"lir_id",␠"worker_id") mz_compute_operator_durations_histogram_raw_s2_primary_idx CREATE␠INDEX␠"mz_compute_operator_durations_histogram_raw_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_compute_operator_durations_histogram_raw"␠("id",␠"worker_id",␠"duration_ns") mz_compute_operator_hydration_statuses_per_worker_s2_primary_idx CREATE␠INDEX␠"mz_compute_operator_hydration_statuses_per_worker_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_compute_operator_hydration_statuses_per_worker"␠("export_id",␠"lir_id") -mz_connections_ind CREATE␠INDEX␠"mz_connections_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s502␠AS␠"mz_catalog"."mz_connections"]␠("schema_id") -mz_console_cluster_utilization_overview_ind CREATE␠INDEX␠"mz_console_cluster_utilization_overview_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s724␠AS␠"mz_internal"."mz_console_cluster_utilization_overview"]␠("cluster_id") -mz_continual_tasks_ind CREATE␠INDEX␠"mz_continual_tasks_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s524␠AS␠"mz_internal"."mz_continual_tasks"]␠("id") -mz_databases_ind CREATE␠INDEX␠"mz_databases_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s467␠AS␠"mz_catalog"."mz_databases"]␠("name") +mz_connections_ind CREATE␠INDEX␠"mz_connections_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s505␠AS␠"mz_catalog"."mz_connections"]␠("schema_id") +mz_console_cluster_utilization_overview_ind CREATE␠INDEX␠"mz_console_cluster_utilization_overview_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s727␠AS␠"mz_internal"."mz_console_cluster_utilization_overview"]␠("cluster_id") +mz_continual_tasks_ind CREATE␠INDEX␠"mz_continual_tasks_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s527␠AS␠"mz_internal"."mz_continual_tasks"]␠("id") +mz_databases_ind CREATE␠INDEX␠"mz_databases_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s470␠AS␠"mz_catalog"."mz_databases"]␠("name") mz_dataflow_addresses_per_worker_s2_primary_idx CREATE␠INDEX␠"mz_dataflow_addresses_per_worker_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_dataflow_addresses_per_worker"␠("id",␠"worker_id") mz_dataflow_channels_per_worker_s2_primary_idx CREATE␠INDEX␠"mz_dataflow_channels_per_worker_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_dataflow_channels_per_worker"␠("id",␠"worker_id") mz_dataflow_operator_reachability_raw_s2_primary_idx CREATE␠INDEX␠"mz_dataflow_operator_reachability_raw_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_dataflow_operator_reachability_raw"␠("id",␠"worker_id",␠"source",␠"port",␠"update_type",␠"time") mz_dataflow_operators_per_worker_s2_primary_idx CREATE␠INDEX␠"mz_dataflow_operators_per_worker_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_dataflow_operators_per_worker"␠("id",␠"worker_id") -mz_frontiers_ind CREATE␠INDEX␠"mz_frontiers_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s712␠AS␠"mz_internal"."mz_frontiers"]␠("object_id") -mz_hydration_statuses_ind CREATE␠INDEX␠"mz_hydration_statuses_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s734␠AS␠"mz_internal"."mz_hydration_statuses"]␠("object_id",␠"replica_id") -mz_indexes_ind CREATE␠INDEX␠"mz_indexes_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s470␠AS␠"mz_catalog"."mz_indexes"]␠("id") -mz_kafka_sources_ind CREATE␠INDEX␠"mz_kafka_sources_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s464␠AS␠"mz_catalog"."mz_kafka_sources"]␠("id") -mz_materialized_views_ind CREATE␠INDEX␠"mz_materialized_views_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s482␠AS␠"mz_catalog"."mz_materialized_views"]␠("id") +mz_frontiers_ind CREATE␠INDEX␠"mz_frontiers_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s715␠AS␠"mz_internal"."mz_frontiers"]␠("object_id") +mz_hydration_statuses_ind CREATE␠INDEX␠"mz_hydration_statuses_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s737␠AS␠"mz_internal"."mz_hydration_statuses"]␠("object_id",␠"replica_id") +mz_indexes_ind CREATE␠INDEX␠"mz_indexes_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s473␠AS␠"mz_catalog"."mz_indexes"]␠("id") +mz_kafka_sources_ind CREATE␠INDEX␠"mz_kafka_sources_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s467␠AS␠"mz_catalog"."mz_kafka_sources"]␠("id") +mz_materialized_views_ind CREATE␠INDEX␠"mz_materialized_views_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s485␠AS␠"mz_catalog"."mz_materialized_views"]␠("id") mz_message_batch_counts_received_raw_s2_primary_idx CREATE␠INDEX␠"mz_message_batch_counts_received_raw_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_message_batch_counts_received_raw"␠("channel_id",␠"from_worker_id",␠"to_worker_id") mz_message_batch_counts_sent_raw_s2_primary_idx CREATE␠INDEX␠"mz_message_batch_counts_sent_raw_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_message_batch_counts_sent_raw"␠("channel_id",␠"from_worker_id",␠"to_worker_id") mz_message_counts_received_raw_s2_primary_idx CREATE␠INDEX␠"mz_message_counts_received_raw_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_message_counts_received_raw"␠("channel_id",␠"from_worker_id",␠"to_worker_id") mz_message_counts_sent_raw_s2_primary_idx CREATE␠INDEX␠"mz_message_counts_sent_raw_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_message_counts_sent_raw"␠("channel_id",␠"from_worker_id",␠"to_worker_id") -mz_notices_ind CREATE␠INDEX␠"mz_notices_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s804␠AS␠"mz_internal"."mz_notices"]␠("id") -mz_object_dependencies_ind CREATE␠INDEX␠"mz_object_dependencies_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s465␠AS␠"mz_internal"."mz_object_dependencies"]␠("object_id") -mz_object_history_ind CREATE␠INDEX␠"mz_object_history_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s534␠AS␠"mz_internal"."mz_object_history"]␠("id") -mz_object_lifetimes_ind CREATE␠INDEX␠"mz_object_lifetimes_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s535␠AS␠"mz_internal"."mz_object_lifetimes"]␠("id") -mz_object_transitive_dependencies_ind CREATE␠INDEX␠"mz_object_transitive_dependencies_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s550␠AS␠"mz_internal"."mz_object_transitive_dependencies"]␠("object_id") -mz_objects_ind CREATE␠INDEX␠"mz_objects_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s531␠AS␠"mz_catalog"."mz_objects"]␠("schema_id") +mz_notices_ind CREATE␠INDEX␠"mz_notices_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s807␠AS␠"mz_internal"."mz_notices"]␠("id") +mz_object_dependencies_ind CREATE␠INDEX␠"mz_object_dependencies_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s468␠AS␠"mz_internal"."mz_object_dependencies"]␠("object_id") +mz_object_history_ind CREATE␠INDEX␠"mz_object_history_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s537␠AS␠"mz_internal"."mz_object_history"]␠("id") +mz_object_lifetimes_ind CREATE␠INDEX␠"mz_object_lifetimes_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s538␠AS␠"mz_internal"."mz_object_lifetimes"]␠("id") +mz_object_transitive_dependencies_ind CREATE␠INDEX␠"mz_object_transitive_dependencies_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s553␠AS␠"mz_internal"."mz_object_transitive_dependencies"]␠("object_id") +mz_objects_ind CREATE␠INDEX␠"mz_objects_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s534␠AS␠"mz_catalog"."mz_objects"]␠("schema_id") mz_peek_durations_histogram_raw_s2_primary_idx CREATE␠INDEX␠"mz_peek_durations_histogram_raw_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_peek_durations_histogram_raw"␠("worker_id",␠"type",␠"duration_ns") -mz_recent_activity_log_thinned_ind CREATE␠INDEX␠"mz_recent_activity_log_thinned_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s696␠AS␠"mz_internal"."mz_recent_activity_log_thinned"]␠("sql_hash") -mz_recent_sql_text_ind CREATE␠INDEX␠"mz_recent_sql_text_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s692␠AS␠"mz_internal"."mz_recent_sql_text"]␠("sql_hash") -mz_recent_storage_usage_ind CREATE␠INDEX␠"mz_recent_storage_usage_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s797␠AS␠"mz_catalog"."mz_recent_storage_usage"]␠("object_id") -mz_roles_ind CREATE␠INDEX␠"mz_roles_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s490␠AS␠"mz_catalog"."mz_roles"]␠("id") +mz_recent_activity_log_thinned_ind CREATE␠INDEX␠"mz_recent_activity_log_thinned_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s699␠AS␠"mz_internal"."mz_recent_activity_log_thinned"]␠("sql_hash") +mz_recent_sql_text_ind CREATE␠INDEX␠"mz_recent_sql_text_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s695␠AS␠"mz_internal"."mz_recent_sql_text"]␠("sql_hash") +mz_recent_storage_usage_ind CREATE␠INDEX␠"mz_recent_storage_usage_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s800␠AS␠"mz_catalog"."mz_recent_storage_usage"]␠("object_id") +mz_roles_ind CREATE␠INDEX␠"mz_roles_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s493␠AS␠"mz_catalog"."mz_roles"]␠("id") mz_scheduling_elapsed_raw_s2_primary_idx CREATE␠INDEX␠"mz_scheduling_elapsed_raw_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_scheduling_elapsed_raw"␠("id",␠"worker_id") mz_scheduling_parks_histogram_raw_s2_primary_idx CREATE␠INDEX␠"mz_scheduling_parks_histogram_raw_s2_primary_idx"␠IN␠CLUSTER␠[s2]␠ON␠"mz_introspection"."mz_scheduling_parks_histogram_raw"␠("worker_id",␠"slept_for_ns",␠"requested_ns") -mz_schemas_ind CREATE␠INDEX␠"mz_schemas_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s468␠AS␠"mz_catalog"."mz_schemas"]␠("database_id") -mz_secrets_ind CREATE␠INDEX␠"mz_secrets_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s501␠AS␠"mz_catalog"."mz_secrets"]␠("name") -mz_show_all_objects_ind CREATE␠INDEX␠"mz_show_all_objects_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s579␠AS␠"mz_internal"."mz_show_all_objects"]␠("schema_id") -mz_show_cluster_replicas_ind CREATE␠INDEX␠"mz_show_cluster_replicas_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s736␠AS␠"mz_internal"."mz_show_cluster_replicas"]␠("cluster") -mz_show_clusters_ind CREATE␠INDEX␠"mz_show_clusters_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s581␠AS␠"mz_internal"."mz_show_clusters"]␠("name") -mz_show_columns_ind CREATE␠INDEX␠"mz_show_columns_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s580␠AS␠"mz_internal"."mz_show_columns"]␠("id") -mz_show_connections_ind CREATE␠INDEX␠"mz_show_connections_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s589␠AS␠"mz_internal"."mz_show_connections"]␠("schema_id") -mz_show_databases_ind CREATE␠INDEX␠"mz_show_databases_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s583␠AS␠"mz_internal"."mz_show_databases"]␠("name") -mz_show_indexes_ind CREATE␠INDEX␠"mz_show_indexes_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s593␠AS␠"mz_internal"."mz_show_indexes"]␠("schema_id") -mz_show_materialized_views_ind CREATE␠INDEX␠"mz_show_materialized_views_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s592␠AS␠"mz_internal"."mz_show_materialized_views"]␠("schema_id") -mz_show_roles_ind CREATE␠INDEX␠"mz_show_roles_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s588␠AS␠"mz_internal"."mz_show_roles"]␠("name") -mz_show_schemas_ind CREATE␠INDEX␠"mz_show_schemas_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s584␠AS␠"mz_internal"."mz_show_schemas"]␠("database_id") -mz_show_secrets_ind CREATE␠INDEX␠"mz_show_secrets_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s582␠AS␠"mz_internal"."mz_show_secrets"]␠("schema_id") -mz_show_sinks_ind CREATE␠INDEX␠"mz_show_sinks_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s591␠AS␠"mz_internal"."mz_show_sinks"]␠("schema_id") -mz_show_sources_ind CREATE␠INDEX␠"mz_show_sources_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s590␠AS␠"mz_internal"."mz_show_sources"]␠("schema_id") -mz_show_tables_ind CREATE␠INDEX␠"mz_show_tables_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s585␠AS␠"mz_internal"."mz_show_tables"]␠("schema_id") -mz_show_types_ind CREATE␠INDEX␠"mz_show_types_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s587␠AS␠"mz_internal"."mz_show_types"]␠("schema_id") -mz_show_views_ind CREATE␠INDEX␠"mz_show_views_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s586␠AS␠"mz_internal"."mz_show_views"]␠("schema_id") -mz_sink_statistics_ind CREATE␠INDEX␠"mz_sink_statistics_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s709␠AS␠"mz_internal"."mz_sink_statistics"]␠("id",␠"replica_id") -mz_sink_status_history_ind CREATE␠INDEX␠"mz_sink_status_history_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s681␠AS␠"mz_internal"."mz_sink_status_history"]␠("sink_id") -mz_sink_statuses_ind CREATE␠INDEX␠"mz_sink_statuses_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s682␠AS␠"mz_internal"."mz_sink_statuses"]␠("id") -mz_sinks_ind CREATE␠INDEX␠"mz_sinks_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s480␠AS␠"mz_catalog"."mz_sinks"]␠("id") -mz_source_statistics_ind CREATE␠INDEX␠"mz_source_statistics_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s707␠AS␠"mz_internal"."mz_source_statistics"]␠("id",␠"replica_id") -mz_source_statistics_with_history_ind CREATE␠INDEX␠"mz_source_statistics_with_history_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s705␠AS␠"mz_internal"."mz_source_statistics_with_history"]␠("id",␠"replica_id") -mz_source_status_history_ind CREATE␠INDEX␠"mz_source_status_history_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s683␠AS␠"mz_internal"."mz_source_status_history"]␠("source_id") -mz_source_statuses_ind CREATE␠INDEX␠"mz_source_statuses_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s700␠AS␠"mz_internal"."mz_source_statuses"]␠("id") -mz_sources_ind CREATE␠INDEX␠"mz_sources_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s473␠AS␠"mz_catalog"."mz_sources"]␠("id") -mz_tables_ind CREATE␠INDEX␠"mz_tables_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s472␠AS␠"mz_catalog"."mz_tables"]␠("schema_id") -mz_types_ind CREATE␠INDEX␠"mz_types_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s484␠AS␠"mz_catalog"."mz_types"]␠("schema_id") -mz_views_ind CREATE␠INDEX␠"mz_views_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s481␠AS␠"mz_catalog"."mz_views"]␠("schema_id") -mz_wallclock_global_lag_recent_history_ind CREATE␠INDEX␠"mz_wallclock_global_lag_recent_history_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s716␠AS␠"mz_internal"."mz_wallclock_global_lag_recent_history"]␠("object_id") -mz_webhook_sources_ind CREATE␠INDEX␠"mz_webhook_sources_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s522␠AS␠"mz_internal"."mz_webhook_sources"]␠("id") -pg_attrdef_all_databases_ind CREATE␠INDEX␠"pg_attrdef_all_databases_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s621␠AS␠"mz_internal"."pg_attrdef_all_databases"]␠("oid",␠"adrelid",␠"adnum",␠"adbin",␠"adsrc") -pg_attribute_all_databases_ind CREATE␠INDEX␠"pg_attribute_all_databases_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s614␠AS␠"mz_internal"."pg_attribute_all_databases"]␠("attrelid",␠"attname",␠"atttypid",␠"attlen",␠"attnum",␠"atttypmod",␠"attnotnull",␠"atthasdef",␠"attidentity",␠"attgenerated",␠"attisdropped",␠"attcollation",␠"database_name",␠"pg_type_database_name") -pg_authid_core_ind CREATE␠INDEX␠"pg_authid_core_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s631␠AS␠"mz_internal"."pg_authid_core"]␠("rolname") -pg_class_all_databases_ind CREATE␠INDEX␠"pg_class_all_databases_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s602␠AS␠"mz_internal"."pg_class_all_databases"]␠("relname") -pg_description_all_databases_ind CREATE␠INDEX␠"pg_description_all_databases_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s611␠AS␠"mz_internal"."pg_description_all_databases"]␠("objoid",␠"classoid",␠"objsubid",␠"description",␠"oid_database_name",␠"class_database_name") -pg_namespace_all_databases_ind CREATE␠INDEX␠"pg_namespace_all_databases_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s599␠AS␠"mz_internal"."pg_namespace_all_databases"]␠("nspname") -pg_type_all_databases_ind CREATE␠INDEX␠"pg_type_all_databases_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s608␠AS␠"mz_internal"."pg_type_all_databases"]␠("oid") +mz_schemas_ind CREATE␠INDEX␠"mz_schemas_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s471␠AS␠"mz_catalog"."mz_schemas"]␠("database_id") +mz_secrets_ind CREATE␠INDEX␠"mz_secrets_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s504␠AS␠"mz_catalog"."mz_secrets"]␠("name") +mz_show_all_objects_ind CREATE␠INDEX␠"mz_show_all_objects_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s582␠AS␠"mz_internal"."mz_show_all_objects"]␠("schema_id") +mz_show_cluster_replicas_ind CREATE␠INDEX␠"mz_show_cluster_replicas_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s739␠AS␠"mz_internal"."mz_show_cluster_replicas"]␠("cluster") +mz_show_clusters_ind CREATE␠INDEX␠"mz_show_clusters_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s584␠AS␠"mz_internal"."mz_show_clusters"]␠("name") +mz_show_columns_ind CREATE␠INDEX␠"mz_show_columns_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s583␠AS␠"mz_internal"."mz_show_columns"]␠("id") +mz_show_connections_ind CREATE␠INDEX␠"mz_show_connections_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s592␠AS␠"mz_internal"."mz_show_connections"]␠("schema_id") +mz_show_databases_ind CREATE␠INDEX␠"mz_show_databases_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s586␠AS␠"mz_internal"."mz_show_databases"]␠("name") +mz_show_indexes_ind CREATE␠INDEX␠"mz_show_indexes_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s596␠AS␠"mz_internal"."mz_show_indexes"]␠("schema_id") +mz_show_materialized_views_ind CREATE␠INDEX␠"mz_show_materialized_views_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s595␠AS␠"mz_internal"."mz_show_materialized_views"]␠("schema_id") +mz_show_roles_ind CREATE␠INDEX␠"mz_show_roles_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s591␠AS␠"mz_internal"."mz_show_roles"]␠("name") +mz_show_schemas_ind CREATE␠INDEX␠"mz_show_schemas_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s587␠AS␠"mz_internal"."mz_show_schemas"]␠("database_id") +mz_show_secrets_ind CREATE␠INDEX␠"mz_show_secrets_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s585␠AS␠"mz_internal"."mz_show_secrets"]␠("schema_id") +mz_show_sinks_ind CREATE␠INDEX␠"mz_show_sinks_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s594␠AS␠"mz_internal"."mz_show_sinks"]␠("schema_id") +mz_show_sources_ind CREATE␠INDEX␠"mz_show_sources_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s593␠AS␠"mz_internal"."mz_show_sources"]␠("schema_id") +mz_show_tables_ind CREATE␠INDEX␠"mz_show_tables_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s588␠AS␠"mz_internal"."mz_show_tables"]␠("schema_id") +mz_show_types_ind CREATE␠INDEX␠"mz_show_types_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s590␠AS␠"mz_internal"."mz_show_types"]␠("schema_id") +mz_show_views_ind CREATE␠INDEX␠"mz_show_views_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s589␠AS␠"mz_internal"."mz_show_views"]␠("schema_id") +mz_sink_statistics_ind CREATE␠INDEX␠"mz_sink_statistics_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s712␠AS␠"mz_internal"."mz_sink_statistics"]␠("id",␠"replica_id") +mz_sink_status_history_ind CREATE␠INDEX␠"mz_sink_status_history_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s684␠AS␠"mz_internal"."mz_sink_status_history"]␠("sink_id") +mz_sink_statuses_ind CREATE␠INDEX␠"mz_sink_statuses_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s685␠AS␠"mz_internal"."mz_sink_statuses"]␠("id") +mz_sinks_ind CREATE␠INDEX␠"mz_sinks_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s483␠AS␠"mz_catalog"."mz_sinks"]␠("id") +mz_source_statistics_ind CREATE␠INDEX␠"mz_source_statistics_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s710␠AS␠"mz_internal"."mz_source_statistics"]␠("id",␠"replica_id") +mz_source_statistics_with_history_ind CREATE␠INDEX␠"mz_source_statistics_with_history_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s708␠AS␠"mz_internal"."mz_source_statistics_with_history"]␠("id",␠"replica_id") +mz_source_status_history_ind CREATE␠INDEX␠"mz_source_status_history_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s686␠AS␠"mz_internal"."mz_source_status_history"]␠("source_id") +mz_source_statuses_ind CREATE␠INDEX␠"mz_source_statuses_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s703␠AS␠"mz_internal"."mz_source_statuses"]␠("id") +mz_sources_ind CREATE␠INDEX␠"mz_sources_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s476␠AS␠"mz_catalog"."mz_sources"]␠("id") +mz_tables_ind CREATE␠INDEX␠"mz_tables_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s475␠AS␠"mz_catalog"."mz_tables"]␠("schema_id") +mz_types_ind CREATE␠INDEX␠"mz_types_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s487␠AS␠"mz_catalog"."mz_types"]␠("schema_id") +mz_views_ind CREATE␠INDEX␠"mz_views_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s484␠AS␠"mz_catalog"."mz_views"]␠("schema_id") +mz_wallclock_global_lag_recent_history_ind CREATE␠INDEX␠"mz_wallclock_global_lag_recent_history_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s719␠AS␠"mz_internal"."mz_wallclock_global_lag_recent_history"]␠("object_id") +mz_webhook_sources_ind CREATE␠INDEX␠"mz_webhook_sources_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s525␠AS␠"mz_internal"."mz_webhook_sources"]␠("id") +pg_attrdef_all_databases_ind CREATE␠INDEX␠"pg_attrdef_all_databases_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s624␠AS␠"mz_internal"."pg_attrdef_all_databases"]␠("oid",␠"adrelid",␠"adnum",␠"adbin",␠"adsrc") +pg_attribute_all_databases_ind CREATE␠INDEX␠"pg_attribute_all_databases_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s617␠AS␠"mz_internal"."pg_attribute_all_databases"]␠("attrelid",␠"attname",␠"atttypid",␠"attlen",␠"attnum",␠"atttypmod",␠"attnotnull",␠"atthasdef",␠"attidentity",␠"attgenerated",␠"attisdropped",␠"attcollation",␠"database_name",␠"pg_type_database_name") +pg_authid_core_ind CREATE␠INDEX␠"pg_authid_core_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s634␠AS␠"mz_internal"."pg_authid_core"]␠("rolname") +pg_class_all_databases_ind CREATE␠INDEX␠"pg_class_all_databases_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s605␠AS␠"mz_internal"."pg_class_all_databases"]␠("relname") +pg_description_all_databases_ind CREATE␠INDEX␠"pg_description_all_databases_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s614␠AS␠"mz_internal"."pg_description_all_databases"]␠("objoid",␠"classoid",␠"objsubid",␠"description",␠"oid_database_name",␠"class_database_name") +pg_namespace_all_databases_ind CREATE␠INDEX␠"pg_namespace_all_databases_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s602␠AS␠"mz_internal"."pg_namespace_all_databases"]␠("nspname") +pg_type_all_databases_ind CREATE␠INDEX␠"pg_type_all_databases_ind"␠IN␠CLUSTER␠[s2]␠ON␠[s611␠AS␠"mz_internal"."pg_type_all_databases"]␠("oid") # Record all transitive dependencies (tables, sources, views, mvs) of indexes on # the mz_catalog_server cluster. diff --git a/test/sqllogictest/object_ownership.slt b/test/sqllogictest/object_ownership.slt index a131c27426f62..cf46bb18eec2c 100644 --- a/test/sqllogictest/object_ownership.slt +++ b/test/sqllogictest/object_ownership.slt @@ -2157,9 +2157,9 @@ ALTER VIEW mz_introspection.mz_dataflow_operators OWNER TO mz_system db error: ERROR: cannot alter item mz_introspection.mz_dataflow_operators because it is required by the database system simple conn=mz_system,user=mz_system -ALTER TABLE mz_views OWNER TO mz_system +ALTER TABLE mz_tables OWNER TO mz_system ---- -db error: ERROR: cannot alter item mz_catalog.mz_views because it is required by the database system +db error: ERROR: cannot alter item mz_catalog.mz_tables because it is required by the database system simple conn=mz_system,user=mz_system ALTER VIEW mz_relations OWNER TO mz_system diff --git a/test/testdrive/catalog.td b/test/testdrive/catalog.td index b557ffe080cf8..322583c3d6a01 100644 --- a/test/testdrive/catalog.td +++ b/test/testdrive/catalog.td @@ -543,7 +543,6 @@ mz_ssh_tunnel_connections "" mz_system_privileges "" mz_tables "" mz_types "" -mz_views "" > SHOW VIEWS FROM mz_catalog name comment @@ -561,6 +560,7 @@ name cluster comment mz_databases mz_catalog_server "" mz_role_members mz_catalog_server "" mz_schemas mz_catalog_server "" +mz_views mz_catalog_server "" # Check default sources, tables, and views in mz_catalog_unstable. @@ -816,7 +816,7 @@ test_table "" # `SHOW TABLES` and `mz_tables` should agree. > SELECT COUNT(*) FROM mz_tables WHERE id LIKE 's%' -57 +56 # There is one entry in mz_indexes for each field_number/expression of the index. > SELECT COUNT(id) FROM mz_indexes WHERE id LIKE 's%'