forked from GreptimeTeam/greptimedb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: table resolving logic related to pg_catalog
refer to GreptimeTeam#3560 (comment) and GreptimeTeam#4543
- Loading branch information
1 parent
3973d6b
commit b1072ad
Showing
52 changed files
with
379 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2023 Greptime Team | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
use sql::dialect::{Dialect, MySqlDialect, PostgreSqlDialect}; | ||
|
||
/// [`CatalogProtocol`] will affect the behaviour of CatalogManager | ||
/// Currently, it mainly affects the table names resolving | ||
/// `pg_catalog` will be only visible under PostgreSQL protocol, and user | ||
/// can access any `pg_catalog` tables with bare table name. | ||
/// | ||
/// The `information_schema` will be visible for Mysql and any other protocol. | ||
#[derive(Clone, Copy, PartialEq, Eq)] | ||
pub enum CatalogProtocol { | ||
MySQL, | ||
PostgreSQL, | ||
Other, | ||
} | ||
|
||
impl CatalogProtocol { | ||
pub fn from_query_dialect(query_dialect: &dyn Dialect) -> Self { | ||
if query_dialect.is::<MySqlDialect>() { | ||
CatalogProtocol::MySQL | ||
} else if query_dialect.is::<PostgreSqlDialect>() { | ||
CatalogProtocol::PostgreSQL | ||
} else { | ||
CatalogProtocol::Other | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.