From 15a99081d0a4ee95f09f4cc19af6faa7e15481dc Mon Sep 17 00:00:00 2001 From: "chunshao.rcs" Date: Thu, 1 Dec 2022 17:05:56 +0800 Subject: [PATCH] chore: return schema not found when schema not exists (#439) * chore: return schema not found when shcmea not exists * refactor by CR --- sql/src/provider.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sql/src/provider.rs b/sql/src/provider.rs index 855189f8b8..9e7e5e412e 100644 --- a/sql/src/provider.rs +++ b/sql/src/provider.rs @@ -34,6 +34,9 @@ pub enum Error { source: catalog::Error, }, + #[snafu(display("Failed to find schema, name:{}", name))] + SchemaNotFound { name: String }, + #[snafu(display("Failed to find table, name:{}, err:{}", name, source))] FindTable { name: String, @@ -111,7 +114,12 @@ impl<'a> MetaProvider for CatalogMetaProvider<'a> { name: resolved.schema, })? { Some(s) => s, - None => return Ok(None), + None => { + return SchemaNotFound { + name: resolved.schema, + } + .fail(); + } }; schema.table_by_name(resolved.table).context(FindTable {