mz_repr/
namespaces.rs

1// Copyright Materialize, Inc. and contributors. All rights reserved.
2//
3// Use of this software is governed by the Business Source License
4// included in the LICENSE file.
5//
6// As of the Change Date specified in that file, in accordance with
7// the Business Source License, use of this software will be governed
8// by the Apache License, Version 2.0.
9
10//! Namespace constants to share between high- and low-levels of the system.
11
12// TODO: define default database, schema names
13
14pub const MZ_TEMP_SCHEMA: &str = "mz_temp";
15pub const MZ_CATALOG_SCHEMA: &str = "mz_catalog";
16pub const MZ_CATALOG_UNSTABLE_SCHEMA: &str = "mz_catalog_unstable";
17pub const PG_CATALOG_SCHEMA: &str = "pg_catalog";
18pub const MZ_INTERNAL_SCHEMA: &str = "mz_internal";
19pub const MZ_INTROSPECTION_SCHEMA: &str = "mz_introspection";
20pub const INFORMATION_SCHEMA: &str = "information_schema";
21pub const MZ_UNSAFE_SCHEMA: &str = "mz_unsafe";
22
23pub const SYSTEM_SCHEMAS: &[&str] = &[
24    MZ_CATALOG_SCHEMA,
25    MZ_CATALOG_UNSTABLE_SCHEMA,
26    PG_CATALOG_SCHEMA,
27    MZ_INTERNAL_SCHEMA,
28    MZ_INTROSPECTION_SCHEMA,
29    INFORMATION_SCHEMA,
30    MZ_UNSAFE_SCHEMA,
31];
32
33pub const UNSTABLE_SCHEMAS: &[&str] = &[
34    MZ_CATALOG_UNSTABLE_SCHEMA,
35    MZ_INTERNAL_SCHEMA,
36    MZ_INTROSPECTION_SCHEMA,
37    MZ_UNSAFE_SCHEMA,
38];
39
40/// Returns whether `name` identifies is a system schema.
41pub fn is_system_schema(name: &str) -> bool {
42    SYSTEM_SCHEMAS.contains(&name)
43}
44
45/// Returns whether `name` identifies is an unstable schema.
46pub fn is_unstable_schema(name: &str) -> bool {
47    UNSTABLE_SCHEMAS.contains(&name)
48}