From b0f5d4718ac266e489edb4769c2d178c619c1a87 Mon Sep 17 00:00:00 2001 From: Runji Wang Date: Mon, 3 Jun 2024 18:42:44 +0800 Subject: [PATCH 1/2] remove `pg_keywords` Signed-off-by: Runji Wang --- .../catalog/system_catalog/pg_catalog/mod.rs | 1 - .../system_catalog/pg_catalog/pg_keywords.rs | 71 ------------------- 2 files changed, 72 deletions(-) delete mode 100644 src/frontend/src/catalog/system_catalog/pg_catalog/pg_keywords.rs diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/mod.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/mod.rs index de1fe4924642f..3d1c8f2a56f74 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/mod.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/mod.rs @@ -29,7 +29,6 @@ mod pg_extension; mod pg_index; mod pg_indexes; mod pg_inherits; -mod pg_keywords; mod pg_language; mod pg_locks; mod pg_matviews; diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_keywords.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_keywords.rs deleted file mode 100644 index a859527afa6df..0000000000000 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_keywords.rs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2024 RisingWave Labs -// -// 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. - -// The code is same as `expr/impl/src/table_function/pg_get_keywords.rs`. - -use risingwave_common::types::Fields; -use risingwave_frontend_macro::system_catalog; -use risingwave_sqlparser::keywords::{ - ALL_KEYWORDS_INDEX, RESERVED_FOR_COLUMN_ALIAS, RESERVED_FOR_COLUMN_OR_TABLE_NAME, -}; - -use crate::catalog::system_catalog::SysCatalogReaderImpl; - -/// The catalog `pg_keywords` stores keywords. `pg_get_keywords` returns the content of this table. -/// Ref: [`https://www.postgresql.org/docs/15/functions-info.html`] -/// -/// # Example -/// -/// ```slt -/// query TTT -/// select * from pg_keywords where word = 'add'; -/// ---- -/// add U unreserved -/// ``` -#[derive(Fields)] -struct PgKeywords { - #[primary_key] - word: String, - catcode: char, - catdesc: &'static str, -} - -#[system_catalog(table, "pg_catalog.pg_keywords")] -fn read_pg_keywords(_reader: &SysCatalogReaderImpl) -> Vec { - ALL_KEYWORDS_INDEX - .iter() - .map(|keyword| { - // FIXME: The current category is not correct. Many are different from the PostgreSQL. - let catcode = if !RESERVED_FOR_COLUMN_OR_TABLE_NAME.contains(keyword) { - 'U' - } else if !RESERVED_FOR_COLUMN_ALIAS.contains(keyword) { - 'C' - } else { - 'R' - }; - let catdesc = match catcode { - 'U' => "unreserved", - 'C' => "unreserved (cannot be function or type name)", - 'T' => "reserved (can be function or type name)", - 'R' => "reserved", - _ => unreachable!(), - }; - PgKeywords { - word: keyword.to_string().to_lowercase(), - catcode, - catdesc, - } - }) - .collect() -} From 704864beb699f2e3d9d31e442656a67f78cbb03f Mon Sep 17 00:00:00 2001 From: Runji Wang Date: Mon, 3 Jun 2024 19:22:18 +0800 Subject: [PATCH 2/2] update slt Signed-off-by: Runji Wang --- e2e_test/batch/catalog/pg_class.slt.part | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e_test/batch/catalog/pg_class.slt.part b/e2e_test/batch/catalog/pg_class.slt.part index ffb53e32d66b5..a6fe4a1257122 100644 --- a/e2e_test/batch/catalog/pg_class.slt.part +++ b/e2e_test/batch/catalog/pg_class.slt.part @@ -20,4 +20,4 @@ SELECT oid,relname,relowner,relkind FROM pg_catalog.pg_class ORDER BY oid limit query ITIT SELECT oid,relname,relowner,relkind FROM pg_catalog.pg_class WHERE oid = 'pg_namespace'::regclass; ---- -2147478671 pg_namespace 1 v +2147478670 pg_namespace 1 v