You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2023/06/20 10:08:40 UTC
[shardingsphere] branch master updated: Add pg_catalog table (#26455)
This is an automated email from the ASF dual-hosted git repository.
jianglongtao 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 b76c01882db Add pg_catalog table (#26455)
b76c01882db is described below
commit b76c01882db3696d204d510d2711bfde0ac3ad09
Author: Zichao <57...@users.noreply.github.com>
AuthorDate: Tue Jun 20 22:08:33 2023 +1200
Add pg_catalog table (#26455)
* add pg_catalog tables
* add pg_catalog tables
---
.../schema/builder/SystemSchemaBuilderRule.java | 7 +-
.../schema/postgresql/pg_catalog/pg_attribute.yaml | 232 +++++++++++++++++++++
.../postgresql/pg_catalog/pg_auth_members.yaml | 56 +++++
.../schema/postgresql/pg_catalog/pg_authid.yaml | 120 +++++++++++
.../builder/SystemSchemaBuilderRuleTest.java | 5 +-
.../schema/builder/SystemSchemaBuilderTest.java | 2 +-
6 files changed, 416 insertions(+), 6 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 fb9099905fe..8937be48df0 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
@@ -76,9 +76,9 @@ 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_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_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_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"))),
@@ -157,5 +157,4 @@ public enum SystemSchemaBuilderRule {
}
return false;
}
-
}
diff --git a/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_attribute.yaml b/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_attribute.yaml
new file mode 100644
index 00000000000..b760ef8b0b1
--- /dev/null
+++ b/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_attribute.yaml
@@ -0,0 +1,232 @@
+#
+# 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_attribute
+columns:
+ attrelid:
+ caseSensitive: true
+ dataType: -5
+ generated: false
+ name: attrelid
+ primaryKey: true
+ unsigned: false
+ visible: true
+ attname:
+ caseSensitive: true
+ dataType: 12
+ generated: false
+ name: attname
+ primaryKey: false
+ unsigned: false
+ visible: true
+ atttypid:
+ caseSensitive: true
+ dataType: -5
+ generated: false
+ name: atttypid
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attstattarget:
+ caseSensitive: true
+ dataType: 4
+ generated: false
+ name: attstattarget
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attlen:
+ caseSensitive: true
+ dataType: 5
+ generated: false
+ name: attlen
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attnum:
+ caseSensitive: true
+ dataType: 5
+ generated: false
+ name: attnum
+ primaryKey: true
+ unsigned: false
+ visible: true
+ attndims:
+ caseSensitive: true
+ dataType: 4
+ generated: false
+ name: attndims
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attcacheoff:
+ caseSensitive: true
+ dataType: 4
+ generated: false
+ name: attcacheoff
+ primaryKey: false
+ unsigned: false
+ visible: true
+ atttypmod:
+ caseSensitive: true
+ dataType: 4
+ generated: false
+ name: atttypmod
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attbyval:
+ caseSensitive: true
+ dataType: -7
+ generated: false
+ name: attbyval
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attalign:
+ caseSensitive: true
+ dataType: 1
+ generated: false
+ name: attalign
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attstorage:
+ caseSensitive: true
+ dataType: 1
+ generated: false
+ name: attstorage
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attcompression:
+ caseSensitive: true
+ dataType: 1
+ generated: false
+ name: attcompression
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attnotnull:
+ caseSensitive: true
+ dataType: -7
+ generated: false
+ name: attnotnull
+ primaryKey: false
+ unsigned: false
+ visible: true
+ atthasdef:
+ caseSensitive: true
+ dataType: -7
+ generated: false
+ name: atthasdef
+ primaryKey: false
+ unsigned: false
+ visible: true
+ atthasmissing:
+ caseSensitive: true
+ dataType: -7
+ generated: false
+ name: atthasmissing
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attidentity:
+ caseSensitive: true
+ dataType: 1
+ generated: false
+ name: attidentity
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attgenerated:
+ caseSensitive: true
+ dataType: 1
+ generated: false
+ name: attgenerated
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attisdropped:
+ caseSensitive: true
+ dataType: -7
+ generated: false
+ name: attisdropped
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attislocal:
+ caseSensitive: true
+ dataType: -7
+ generated: false
+ name: attislocal
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attinhcount:
+ caseSensitive: true
+ dataType: 4
+ generated: false
+ name: attinhcount
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attcollation:
+ caseSensitive: true
+ dataType: -5
+ generated: false
+ name: attcollation
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attacl:
+ caseSensitive: true
+ dataType: 2003
+ generated: false
+ name: attacl
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attoptions:
+ caseSensitive: true
+ dataType: 2003
+ generated: false
+ name: attoptions
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attfdwoptions:
+ caseSensitive: true
+ dataType: 2003
+ generated: false
+ name: attfdwoptions
+ primaryKey: false
+ unsigned: false
+ visible: true
+ attmissingval:
+ caseSensitive: true
+ dataType: 1111
+ generated: false
+ name: attmissingval
+ primaryKey: false
+ unsigned: false
+ visible: true
+indexes:
+ pg_attribute_relid_attnam_index:
+ name: pg_attribute_relid_attnam_index
+ pg_attribute_relid_attnum_index:
+ name: pg_attribute_relid_attnum_index
diff --git a/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_auth_members.yaml b/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_auth_members.yaml
new file mode 100644
index 00000000000..37b8fd2069c
--- /dev/null
+++ b/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_auth_members.yaml
@@ -0,0 +1,56 @@
+#
+# 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_auth_members
+columns:
+ roleid:
+ caseSensitive: true
+ dataType: -5
+ generated: false
+ name: roleid
+ primaryKey: true
+ unsigned: false
+ visible: true
+ member:
+ caseSensitive: true
+ dataType: -5
+ generated: false
+ name: member
+ primaryKey: true
+ unsigned: false
+ visible: true
+ grantor:
+ caseSensitive: true
+ dataType: -5
+ generated: false
+ name: grantor
+ primaryKey: false
+ unsigned: false
+ visible: true
+ admin_option:
+ caseSensitive: true
+ dataType: -7
+ generated: false
+ name: admin_option
+ primaryKey: false
+ unsigned: false
+ visible: true
+indexes:
+ pg_auth_members_member_role_index:
+ name: pg_auth_members_member_role_index
+ pg_auth_members_role_member_index:
+ name: pg_auth_members_role_member_index
diff --git a/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_authid.yaml b/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_authid.yaml
new file mode 100644
index 00000000000..949c08350d2
--- /dev/null
+++ b/infra/common/src/main/resources/schema/postgresql/pg_catalog/pg_authid.yaml
@@ -0,0 +1,120 @@
+#
+# 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_authid
+columns:
+ oid:
+ caseSensitive: true
+ dataType: -5
+ generated: false
+ name: oid
+ primaryKey: true
+ unsigned: false
+ visible: true
+ rolname:
+ caseSensitive: true
+ dataType: 12
+ generated: false
+ name: rolname
+ primaryKey: false
+ unsigned: false
+ visible: true
+ rolsuper:
+ caseSensitive: true
+ dataType: -7
+ generated: false
+ name: rolsuper
+ primaryKey: false
+ unsigned: false
+ visible: true
+ rolinherit:
+ caseSensitive: true
+ dataType: -7
+ generated: false
+ name: rolinherit
+ primaryKey: false
+ unsigned: false
+ visible: true
+ rolcreaterole:
+ caseSensitive: true
+ dataType: -7
+ generated: false
+ name: rolcreaterole
+ primaryKey: false
+ unsigned: false
+ visible: true
+ rolcreatedb:
+ caseSensitive: true
+ dataType: -7
+ generated: false
+ name: rolcreatedb
+ primaryKey: false
+ unsigned: false
+ visible: true
+ rolcanlogin:
+ caseSensitive: true
+ dataType: -7
+ generated: false
+ name: rolcanlogin
+ primaryKey: false
+ unsigned: false
+ visible: true
+ rolreplication:
+ caseSensitive: true
+ dataType: -7
+ generated: false
+ name: rolreplication
+ primaryKey: false
+ unsigned: false
+ visible: true
+ rolbypassrls:
+ caseSensitive: true
+ dataType: -7
+ generated: false
+ name: rolbypassrls
+ primaryKey: false
+ unsigned: false
+ visible: true
+ rolconnlimit:
+ caseSensitive: true
+ dataType: 4
+ generated: false
+ name: rolconnlimit
+ primaryKey: false
+ unsigned: false
+ visible: true
+ rolpassword:
+ caseSensitive: true
+ dataType: 12
+ generated: false
+ name: rolpassword
+ primaryKey: false
+ unsigned: false
+ visible: true
+ rolvaliduntil:
+ caseSensitive: true
+ dataType: 93
+ generated: false
+ name: rolvaliduntil
+ primaryKey: false
+ unsigned: false
+ visible: true
+indexes:
+ pg_authid_rolname_index:
+ name: pg_authid_rolname_index
+ pg_authid_oid_index:
+ name: pg_authid_oid_index
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 5a1d6c8d100..e21966a2d01 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(24));
+ assertThat(actualPgCatalog.getTables().size(), is(27));
}
@Test
@@ -60,6 +60,9 @@ class SystemSchemaBuilderRuleTest {
assertTrue(SystemSchemaBuilderRule.isSystemTable("pg_catalog", "pg_amop"));
assertTrue(SystemSchemaBuilderRule.isSystemTable("pg_catalog", "pg_amproc"));
assertTrue(SystemSchemaBuilderRule.isSystemTable("pg_catalog", "pg_attrdef"));
+ 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_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 91c3146d4cf..2f40368bffd 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(24));
+ assertThat(actual.get("pg_catalog").getTables().size(), is(27));
assertThat(actual.get("shardingsphere").getTables().size(), is(2));
}