From: amit Date: Fri, 13 May 2016 12:10:10 +0900 Subject: [PATCH 2/7] Add a IGNORE dependency type. This new type of dependency is mainly to be used internally as a signal that no dependency should be created between the objects in question. Use this, for example, when there is a possibility that redundant self- dependencies could be created in certain situations - imagine creation of dependencies for objects referenced in expressions in the partition key of a table; it is inevitable that vars of the table in question would be encountered which must be ignored. --- src/backend/catalog/dependency.c | 2 ++ src/backend/catalog/pg_depend.c | 3 +++ src/include/catalog/dependency.h | 8 +++++++- 3 files changed, 12 insertions(+), 1 deletions(-) diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c index 04d7840..607274d 100644 --- a/src/backend/catalog/dependency.c +++ b/src/backend/catalog/dependency.c @@ -717,6 +717,7 @@ findDependentObjects(const ObjectAddress *object, getObjectDescription(object)); break; default: + Assert(foundDep->deptype != DEPENDENCY_IGNORE); elog(ERROR, "unrecognized dependency type '%c' for %s", foundDep->deptype, getObjectDescription(object)); break; @@ -813,6 +814,7 @@ findDependentObjects(const ObjectAddress *object, subflags = 0; /* keep compiler quiet */ break; default: + Assert(foundDep->deptype != DEPENDENCY_IGNORE); elog(ERROR, "unrecognized dependency type '%c' for %s", foundDep->deptype, getObjectDescription(object)); subflags = 0; /* keep compiler quiet */ diff --git a/src/backend/catalog/pg_depend.c b/src/backend/catalog/pg_depend.c index 7a0713e..6e71b44 100644 --- a/src/backend/catalog/pg_depend.c +++ b/src/backend/catalog/pg_depend.c @@ -65,6 +65,9 @@ recordMultipleDependencies(const ObjectAddress *depender, bool nulls[Natts_pg_depend]; Datum values[Natts_pg_depend]; + if (behavior == DEPENDENCY_IGNORE) + return; /* nothing to do */ + if (nreferenced <= 0) return; /* nothing to do */ diff --git a/src/include/catalog/dependency.h b/src/include/catalog/dependency.h index 09b36c5..d44edc6 100644 --- a/src/include/catalog/dependency.h +++ b/src/include/catalog/dependency.h @@ -67,6 +67,11 @@ * created only during initdb. The fields for the dependent object * contain zeroes. * + * DEPENDENCY_IGNORE ('g'): like DEPENDENCY_PIN, there is no dependent + * object; this type of entry is a signal that no dependency should be + * created between the objects in question. However, unlike pin, + * dependencies, these never make it to pg_depend. + * * Other dependency flavors may be needed in future. */ @@ -77,7 +82,8 @@ typedef enum DependencyType DEPENDENCY_INTERNAL = 'i', DEPENDENCY_EXTENSION = 'e', DEPENDENCY_AUTO_EXTENSION = 'x', - DEPENDENCY_PIN = 'p' + DEPENDENCY_PIN = 'p', + DEPENDENCY_IGNORE = 'g' } DependencyType; /* -- 1.7.1 --------------050808050504080802030900 Content-Type: text/x-diff; name="0003-Infrastructure-for-creation-of-partitioned-tables-v5.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0003-Infrastructure-for-creation-of-partitioned-tables-v5.pa"; filename*1="tch"