Skip to content

Commit 5804930

Browse files
gfphoenix78yjhjstz
authored andcommitted
Fix gpcheckcat that checks foreign key reference for appendonly tables
As greenplum-db/gpdb-archive@afde39b3f973c committed in Greenplum upstream, the partition table allows to have table access method. One additional behavior is that the normal appendonly tables have their entries in pg_appendonly, one-per-entry. But the partition table hasn't. The foreign key check is applied. Missing entry in pg_appendonly for tables with relam to be ao_row/ao_column will be reported in gpcheckcat. This commit backports partial changes from the above commit, and will fix the catalog issue.
1 parent c67e370 commit 5804930

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

gpMgmt/bin/gpcheckcat_modules/foreign_key_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def __init__(self, db_connection, logger, shared_option, autoCast):
1515
self.shared_option = shared_option
1616
self.autoCast = autoCast
1717
self.query_filters = dict()
18-
self.query_filters['pg_appendonly.relid'] = "(select amname from pg_am am where am.oid = relam) IN ('ao_row', 'ao_column')"
18+
self.query_filters['pg_appendonly.relid'] = "((select amname from pg_am am where am.oid = relam) IN ('ao_row', 'ao_column')) AND relkind != 'p'"
1919
self.query_filters['pg_attribute.attrelid'] = "(relnatts > 0 or relnatts is NULL)"
2020
self.query_filters["pg_index.indexrelid"] = "(relkind='i')"
2121

gpMgmt/bin/gppylib/test/unit/test_unit_foreign_key_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def __generate_pg_class_call(table, primary_key_cat_name, col_type, with_filter=
175175
####################### PRIVATE METHODS #######################
176176
def _get_filter(self, table_name):
177177
query_filters = {}
178-
query_filters['pg_appendonly'] = "(select amname from pg_am am where am.oid = relam) IN ('ao_row', 'ao_column')"
178+
query_filters['pg_appendonly'] = "((select amname from pg_am am where am.oid = relam) IN ('ao_row', 'ao_column')) AND relkind != 'p'"
179179
query_filters['pg_attribute'] = "(relnatts > 0 or relnatts is NULL)"
180180
query_filters['pg_constraint'] = "((relchecks>0 or relhaspkey='t') and relkind = 'r')"
181181
query_filters['gp_distribution_policy'] = """(relnamespace not in(select oid from pg_namespace where nspname ~ 'pg_')

0 commit comments

Comments
 (0)