This is an automated email from the ASF dual-hosted git repository.

chengzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new fce5b1bb4dd add pg_catalog tables (#26457)
fce5b1bb4dd is described below

commit fce5b1bb4dd32a038cd49e5efe620e6c6ce3cdd9
Author: Zichao <[email protected]>
AuthorDate: Wed Jun 21 15:13:41 2023 +1200

    add pg_catalog tables (#26457)
---
 .../schema/builder/SystemSchemaBuilderRule.java    |  3 +-
 .../pg_available_extension_versions.yaml           | 91 ++++++++++++++++++++++
 .../pg_catalog/pg_available_extensions.yaml        | 51 ++++++++++++
 .../pg_catalog/pg_backend_memory_contexts.yaml     | 91 ++++++++++++++++++++++
 .../schema/postgresql/pg_catalog/pg_cast.yaml      | 72 +++++++++++++++++
 .../builder/SystemSchemaBuilderRuleTest.java       |  6 +-
 .../schema/builder/SystemSchemaBuilderTest.java    |  2 +-
 7 files changed, 313 insertions(+), 3 deletions(-)

diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderRule.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderRule.java
index 8937be48df0..e7a21886619 100644
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderRule.java
+++ 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderRule.java
@@ -77,7 +77,8 @@ public enum SystemSchemaBuilderRule {
     POSTGRESQL_INFORMATION_SCHEMA("PostgreSQL", "information_schema", new 
HashSet<>(Arrays.asList("columns", "tables", "views"))),
     
     POSTGRESQL_PG_CATALOG("PostgreSQL", "pg_catalog", new 
HashSet<>(Arrays.asList("pg_aggregate", "pg_am", "pg_amop", "pg_amproc", 
"pg_attrdef", "pg_attribute", "pg_auth_members", "pg_authid",
-            "pg_class", "pg_database", "pg_tables", "pg_inherits", 
"pg_tablespace", "pg_trigger", "pg_namespace", "pg_range", 
"pg_replication_origin", "pg_rewrite", "pg_seclabel", "pg_sequence",
+            "pg_available_extension_versions", "pg_available_extensions", 
"pg_backend_memory_contexts", "pg_cast", "pg_class",
+            "pg_database", "pg_tables", "pg_inherits", "pg_tablespace", 
"pg_trigger", "pg_namespace", "pg_range", "pg_replication_origin", 
"pg_rewrite", "pg_seclabel", "pg_sequence",
             "pg_roles", "pg_user_mapping", "pg_stat_database_conflicts", 
"pg_stat_gssapi", "pg_stat_progress_analyze", "pg_stat_progress_basebackup", 
"pg_stat_progress_cluster"))),
     
     POSTGRESQL_SHARDING_SPHERE("PostgreSQL", "shardingsphere", new 
HashSet<>(Arrays.asList("sharding_table_statistics", "cluster_information"))),
diff --git 
a/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_available_extension_versions.yaml
 
b/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_available_extension_versions.yaml
new file mode 100644
index 00000000000..a70fd9d45ed
--- /dev/null
+++ 
b/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_available_extension_versions.yaml
@@ -0,0 +1,91 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+name: pg_available_extension_versions
+columns:
+  name:
+    caseSensitive: true
+    dataType: 12
+    generated: false
+    name: name
+    primaryKey: false
+    unsigned: false
+    visible: true
+  version:
+    caseSensitive: true
+    dataType: 12
+    generated: false
+    name: version
+    primaryKey: false
+    unsigned: false
+    visible: true
+  installed:
+    caseSensitive: true
+    dataType: -7
+    generated: false
+    name: installed
+    primaryKey: false
+    unsigned: false
+    visible: true
+  superuser:
+    caseSensitive: true
+    dataType: -7
+    generated: false
+    name: superuser
+    primaryKey: false
+    unsigned: false
+    visible: true
+  trusted:
+    caseSensitive: true
+    dataType: -7
+    generated: false
+    name: trusted
+    primaryKey: false
+    unsigned: false
+    visible: true
+  relocatable:
+    caseSensitive: true
+    dataType: -7
+    generated: false
+    name: relocatable
+    primaryKey: false
+    unsigned: false
+    visible: true
+  schema:
+    caseSensitive: true
+    dataType: 12
+    generated: false
+    name: schema
+    primaryKey: false
+    unsigned: false
+    visible: true
+  requires:
+    caseSensitive: true
+    dataType: 2003
+    generated: false
+    name: requires
+    primaryKey: false
+    unsigned: false
+    visible: true
+  comment:
+    caseSensitive: true
+    dataType: 12
+    generated: false
+    name: comment
+    primaryKey: false
+    unsigned: false
+    visible: true
\ No newline at end of file
diff --git 
a/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_available_extensions.yaml
 
b/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_available_extensions.yaml
new file mode 100644
index 00000000000..71689ff7398
--- /dev/null
+++ 
b/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_available_extensions.yaml
@@ -0,0 +1,51 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+name: pg_available_extensions
+columns:
+  name:
+    caseSensitive: true
+    dataType: 12
+    generated: false
+    name: name
+    primaryKey: false
+    unsigned: false
+    visible: true
+  default_version:
+    caseSensitive: true
+    dataType: 12
+    generated: false
+    name: default_version
+    primaryKey: false
+    unsigned: false
+    visible: true
+  installed_version:
+    caseSensitive: true
+    dataType: 12
+    generated: false
+    name: installed_version
+    primaryKey: false
+    unsigned: false
+    visible: true
+  comment:
+    caseSensitive: true
+    dataType: 12
+    generated: false
+    name: comment
+    primaryKey: false
+    unsigned: false
+    visible: true
\ No newline at end of file
diff --git 
a/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_backend_memory_contexts.yaml
 
b/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_backend_memory_contexts.yaml
new file mode 100644
index 00000000000..ae7551dd8d5
--- /dev/null
+++ 
b/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_backend_memory_contexts.yaml
@@ -0,0 +1,91 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+name: pg_backend_memory_contexts
+columns:
+  name:
+    caseSensitive: true
+    dataType: 12
+    generated: false
+    name: name
+    primaryKey: false
+    unsigned: false
+    visible: true
+  ident:
+    caseSensitive: true
+    dataType: 12
+    generated: false
+    name: ident
+    primaryKey: false
+    unsigned: false
+    visible: true
+  parent:
+    caseSensitive: true
+    dataType: 12
+    generated: false
+    name: parent
+    primaryKey: false
+    unsigned: false
+    visible: true
+  level:
+    caseSensitive: true
+    dataType: 4
+    generated: false
+    name: level
+    primaryKey: false
+    unsigned: false
+    visible: true
+  total_bytes:
+    caseSensitive: true
+    dataType: -5
+    generated: false
+    name: total_bytes
+    primaryKey: false
+    unsigned: false
+    visible: true
+  total_nblocks:
+    caseSensitive: true
+    dataType: -5
+    generated: false
+    name: total_nblocks
+    primaryKey: false
+    unsigned: false
+    visible: true
+  free_bytes:
+    caseSensitive: true
+    dataType: -5
+    generated: false
+    name: free_bytes
+    primaryKey: false
+    unsigned: false
+    visible: true
+  free_chunks:
+    caseSensitive: true
+    dataType: -5
+    generated: false
+    name: free_chunks
+    primaryKey: false
+    unsigned: false
+    visible: true
+  used_bytes:
+    caseSensitive: true
+    dataType: -5
+    generated: false
+    name: used_bytes
+    primaryKey: false
+    unsigned: false
+    visible: true
\ No newline at end of file
diff --git 
a/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_cast.yaml 
b/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_cast.yaml
new file mode 100644
index 00000000000..394a14fbf06
--- /dev/null
+++ b/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_cast.yaml
@@ -0,0 +1,72 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+name: pg_cast
+columns:
+  oid:
+    caseSensitive: true
+    dataType: -5
+    generated: false
+    name: oid
+    primaryKey: true
+    unsigned: false
+    visible: true
+  castsource:
+    caseSensitive: true
+    dataType: -5
+    generated: false
+    name: castsource
+    primaryKey: false
+    unsigned: false
+    visible: true
+  casttarget:
+    caseSensitive: true
+    dataType: -5
+    generated: false
+    name: casttarget
+    primaryKey: false
+    unsigned: false
+    visible: true
+  castfunc:
+    caseSensitive: true
+    dataType: -5
+    generated: false
+    name: castfunc
+    primaryKey: false
+    unsigned: false
+    visible: true
+  castcontext:
+    caseSensitive: true
+    dataType: 1
+    generated: false
+    name: castcontext
+    primaryKey: false
+    unsigned: false
+    visible: true
+  castmethod:
+    caseSensitive: true
+    dataType: 1
+    generated: false
+    name: castmethod
+    primaryKey: false
+    unsigned: false
+    visible: true
+indexes:
+  pg_cast_source_target_index:
+    name: pg_cast_source_target_index
+  pg_cast_oid_index:
+    name: pg_cast_oid_index
\ No newline at end of file
diff --git 
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderRuleTest.java
 
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderRuleTest.java
index e21966a2d01..1eb1523d2ac 100644
--- 
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderRuleTest.java
+++ 
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderRuleTest.java
@@ -42,7 +42,7 @@ class SystemSchemaBuilderRuleTest {
         assertThat(actualPerformanceSchema.getTables().size(), is(87));
         SystemSchemaBuilderRule actualPgCatalog = 
SystemSchemaBuilderRule.valueOf(new PostgreSQLDatabaseType().getType(), 
"pg_catalog");
         assertThat(actualPgCatalog, 
is(SystemSchemaBuilderRule.POSTGRESQL_PG_CATALOG));
-        assertThat(actualPgCatalog.getTables().size(), is(27));
+        assertThat(actualPgCatalog.getTables().size(), is(31));
     }
     
     @Test
@@ -63,6 +63,10 @@ class SystemSchemaBuilderRuleTest {
         assertTrue(SystemSchemaBuilderRule.isSystemTable("pg_catalog", 
"pg_attribute"));
         assertTrue(SystemSchemaBuilderRule.isSystemTable("pg_catalog", 
"pg_auth_members"));
         assertTrue(SystemSchemaBuilderRule.isSystemTable("pg_catalog", 
"pg_authid"));
+        assertTrue(SystemSchemaBuilderRule.isSystemTable("pg_catalog", 
"pg_available_extension_versions"));
+        assertTrue(SystemSchemaBuilderRule.isSystemTable("pg_catalog", 
"pg_available_extensions"));
+        assertTrue(SystemSchemaBuilderRule.isSystemTable("pg_catalog", 
"pg_backend_memory_contexts"));
+        assertTrue(SystemSchemaBuilderRule.isSystemTable("pg_catalog", 
"pg_cast"));
         assertTrue(SystemSchemaBuilderRule.isSystemTable("pg_catalog", 
"pg_range"));
         assertTrue(SystemSchemaBuilderRule.isSystemTable("pg_catalog", 
"pg_replication_origin"));
         assertTrue(SystemSchemaBuilderRule.isSystemTable("pg_catalog", 
"pg_rewrite"));
diff --git 
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderTest.java
 
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderTest.java
index 2f40368bffd..c9ca105c3b4 100644
--- 
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderTest.java
+++ 
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderTest.java
@@ -55,7 +55,7 @@ class SystemSchemaBuilderTest {
         assertTrue(actual.containsKey("pg_catalog"));
         assertTrue(actual.containsKey("shardingsphere"));
         assertThat(actual.get("information_schema").getTables().size(), is(3));
-        assertThat(actual.get("pg_catalog").getTables().size(), is(27));
+        assertThat(actual.get("pg_catalog").getTables().size(), is(31));
         assertThat(actual.get("shardingsphere").getTables().size(), is(2));
     }
     

Reply via email to