(
&mut self,
name: <Raw as AstInfo>::SchemaName,
)
| 1863 | } |
| 1864 | |
| 1865 | fn fold_schema_name( |
| 1866 | &mut self, |
| 1867 | name: <Raw as AstInfo>::SchemaName, |
| 1868 | ) -> <Aug as AstInfo>::SchemaName { |
| 1869 | let norm_name = match normalize::unresolved_schema_name(name) { |
| 1870 | Ok(norm_name) => norm_name, |
| 1871 | Err(e) => { |
| 1872 | if self.status.is_ok() { |
| 1873 | self.status = Err(e); |
| 1874 | } |
| 1875 | return ResolvedSchemaName::Error; |
| 1876 | } |
| 1877 | }; |
| 1878 | |
| 1879 | // Special case for mz_temp: with lazy temporary schema creation, the temp |
| 1880 | // schema may not exist yet. Return a resolved name with SchemaSpecifier::Temporary |
| 1881 | // so that downstream code can handle it appropriately (e.g., return a proper error). |
| 1882 | if norm_name.database.is_none() && norm_name.schema == mz_repr::namespaces::MZ_TEMP_SCHEMA { |
| 1883 | return ResolvedSchemaName::Schema { |
| 1884 | database_spec: ResolvedDatabaseSpecifier::Ambient, |
| 1885 | schema_spec: SchemaSpecifier::Temporary, |
| 1886 | full_name: FullSchemaName { |
| 1887 | database: RawDatabaseSpecifier::Ambient, |
| 1888 | schema: mz_repr::namespaces::MZ_TEMP_SCHEMA.to_string(), |
| 1889 | }, |
| 1890 | }; |
| 1891 | } |
| 1892 | |
| 1893 | match self |
| 1894 | .catalog |
| 1895 | .resolve_schema(norm_name.database.as_deref(), norm_name.schema.as_str()) |
| 1896 | { |
| 1897 | Ok(schema) => { |
| 1898 | let raw_database_spec = match schema.database() { |
| 1899 | ResolvedDatabaseSpecifier::Ambient => RawDatabaseSpecifier::Ambient, |
| 1900 | ResolvedDatabaseSpecifier::Id(id) => { |
| 1901 | RawDatabaseSpecifier::Name(self.catalog.get_database(id).name().to_string()) |
| 1902 | } |
| 1903 | }; |
| 1904 | ResolvedSchemaName::Schema { |
| 1905 | database_spec: schema.database().clone(), |
| 1906 | schema_spec: schema.id().clone(), |
| 1907 | full_name: FullSchemaName { |
| 1908 | database: raw_database_spec, |
| 1909 | schema: schema.name().schema.clone(), |
| 1910 | }, |
| 1911 | } |
| 1912 | } |
| 1913 | Err(e) => { |
| 1914 | if self.status.is_ok() { |
| 1915 | self.status = Err(e.into()); |
| 1916 | } |
| 1917 | ResolvedSchemaName::Error |
| 1918 | } |
| 1919 | } |
| 1920 | } |
| 1921 | |
| 1922 | fn fold_database_name( |
no test coverage detected